Pārlūkot izejas kodu

Bring back the Lock as it's technically correct.

Chris Rhodes 9 gadi atpakaļ
vecāks
revīzija
c291988335
1 mainītis faili ar 2 papildinājumiem un 4 dzēšanām
  1. 2 4
      discord.go

+ 2 - 4
discord.go

@@ -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()