Skip to content

Commit

Permalink
fix race in http
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanielc committed Nov 23, 2015
1 parent 397888a commit f05b4cb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion http_out.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ func (h *HTTPOutNode) runOut() error {
}}

h.endpoint = h.et.tm.HTTPDService.Addr().String() + httpd.APIRoot + p
h.routes = r
func() {
h.mu.Lock()
defer h.mu.Unlock()
h.routes = r
}()

err := h.et.tm.HTTPDService.AddRoutes(r)
if err != nil {
Expand Down Expand Up @@ -107,5 +111,7 @@ func (h *HTTPOutNode) updateResultWithRow(group models.GroupID, row *imodels.Row
}

func (h *HTTPOutNode) stopOut() {
h.mu.Lock()
defer h.mu.Unlock()
h.et.tm.HTTPDService.DelRoutes(h.routes)
}

0 comments on commit f05b4cb

Please sign in to comment.