1
0
Fork 0
forked from External/ergo

fix more data races

This commit is contained in:
Jeremy Latt 2014-02-14 08:42:56 -08:00
parent 6ea3c8f4d1
commit 9600be82a3
2 changed files with 10 additions and 0 deletions

View file

@ -9,6 +9,7 @@ import (
"log"
"net"
"os"
"sync"
"time"
)
@ -17,6 +18,7 @@ type Server struct {
commands chan Command
ctime time.Time
motdFile string
mutex *sync.Mutex
name string
operators map[string]string
password string
@ -30,6 +32,7 @@ func NewServer(config *Config) *Server {
commands: make(chan Command),
ctime: time.Now(),
motdFile: config.MOTD,
mutex: &sync.Mutex{},
name: config.Name,
operators: make(map[string]string),
password: config.Password,
@ -296,7 +299,9 @@ func (m *QuitCommand) HandleServer(server *Server) {
iclients.Remove(client)
for channel := range client.channels {
channel.mutex.Lock()
channel.members.Remove(client)
channel.mutex.Unlock()
}
client.Reply(RplError(server, client))