forked from pothtonswer/discordmuffin
Fix possible mutex deadlock in handle()
Also added some logging.
This commit is contained in:
parent
32aa5718d1
commit
7ed2a289bc
1 changed files with 4 additions and 2 deletions
|
@ -205,13 +205,13 @@ func (s *Session) handle(event interface{}) {
|
|||
|
||||
if handlers, ok := s.handlers[nil]; ok {
|
||||
for _, handler := range handlers {
|
||||
handler.Call(handlerParameters)
|
||||
go handler.Call(handlerParameters)
|
||||
}
|
||||
}
|
||||
|
||||
if handlers, ok := s.handlers[reflect.TypeOf(event)]; ok {
|
||||
for _, handler := range handlers {
|
||||
handler.Call(handlerParameters)
|
||||
go handler.Call(handlerParameters)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -219,6 +219,8 @@ func (s *Session) handle(event interface{}) {
|
|||
// initialize adds all internal handlers and state tracking handlers.
|
||||
func (s *Session) initialize() {
|
||||
|
||||
s.log(LogInformational, "called")
|
||||
|
||||
s.handlersMu.Lock()
|
||||
if s.handlers != nil {
|
||||
s.handlersMu.Unlock()
|
||||
|
|
Loading…
Reference in a new issue