summaryrefslogtreecommitdiff
path: root/service/http/handler.go
diff options
context:
space:
mode:
Diffstat (limited to 'service/http/handler.go')
-rw-r--r--service/http/handler.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/service/http/handler.go b/service/http/handler.go
index 8c604127..2d749207 100644
--- a/service/http/handler.go
+++ b/service/http/handler.go
@@ -113,10 +113,9 @@ func (h *Handler) handleError(w http.ResponseWriter, r *http.Request, err error)
// throw invokes event srv if any.
func (h *Handler) throw(event int, ctx interface{}) {
h.mul.Lock()
- lsn := h.lsn
- h.mul.Unlock()
+ defer h.mul.Unlock()
- if lsn != nil {
- lsn(event, ctx)
+ if h.lsn != nil {
+ h.lsn(event, ctx)
}
}