fix a race

This commit is contained in:
Jeremy Latt
2014-02-15 20:20:37 -08:00
parent 213afc0481
commit 0f6ee63e6e
2 changed files with 18 additions and 8 deletions
+5 -3
View File
@@ -364,12 +364,14 @@ func (m *JoinCommand) HandleServer(s *Server) {
}
}
func (m *PartCommand) HandleServer(s *Server) {
func (m *PartCommand) HandleServer(server *Server) {
for _, chname := range m.channels {
channel := s.channels[chname]
server.mutex.Lock()
channel := server.channels[chname]
server.mutex.Unlock()
if channel == nil {
m.Client().Reply(ErrNoSuchChannel(s, channel.name))
m.Client().Reply(ErrNoSuchChannel(server, channel.name))
continue
}