Adding subscription should be safe

and not happen while cleaning up
This commit is contained in:
Gregory Eremin 2014-09-11 23:13:44 +04:00
parent 1735f11058
commit 2a0d88c3bb

View File

@ -54,7 +54,9 @@ func (h *Hub) Sub(s *Subscription) {
} }
} }
h.lock.Lock()
h.subscribers = append(h.subscribers, s) h.subscribers = append(h.subscribers, s)
h.lock.Unlock()
} }
func (h *Hub) Info() map[string]map[string]uint { func (h *Hub) Info() map[string]map[string]uint {