Bring back the Lock as it's technically correct.

This commit is contained in:
Chris Rhodes 2016-02-19 22:32:15 -08:00
parent 79247272ff
commit c291988335

View file

@ -218,14 +218,12 @@ func (s *Session) handle(event interface{}) {
// initialize adds all internal handlers and state tracking handlers.
func (s *Session) initialize() {
s.handlersMu.RLock()
s.handlersMu.Lock()
if s.handlers != nil {
s.handlersMu.RUnlock()
s.handlersMu.Unlock()
return
}
s.handlersMu.RUnlock()
s.handlersMu.Lock()
s.handlers = map[interface{}][]reflect.Value{}
s.handlersMu.Unlock()