Explorar o código

Merge pull request #122 from iopred/patch-2

Fix a Lock instead of RLock in initialize.
Bruce %!s(int64=9) %!d(string=hai) anos
pai
achega
bb612a0e8b
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      discord.go

+ 4 - 2
discord.go

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