Commit 95781a0a authored by masala's avatar masala

re-obtain lock before mutating map

parent 211cf662
......@@ -45,16 +45,21 @@ func (s *Session) waitForSent(id MessageID) error {
err = fmt.Errorf("[%v] Failure waiting for reply, invalid message ID", id)
} else {
if msg.Sent {
s.mapLock.Unlock()
return nil
}
}
waitCh, ok = s.waitSentChans[*id]
s.mapLock.Unlock()
if ok {
defer delete(s.waitSentChans, *id)
func() {
s.mapLock.Lock()
delete(s.waitSentChans, *id)
s.mapLock.Unlock()
}
} else {
err = fmt.Errorf("[%v] Failure waiting for reply, invalid message ID", id)
}
s.mapLock.Unlock()
if err != nil {
return err
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment