3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-01 16:39:26 +01:00

instantiate clients in the server command goroutine

This commit is contained in:
Jeremy Latt 2014-02-16 22:30:01 -08:00
parent dc5e258f88
commit d5c9681a10

View File

@ -122,7 +122,10 @@ func (s *Server) listen(config ListenerConfig) {
if DEBUG_SERVER { if DEBUG_SERVER {
log.Print("Server.Accept: ", conn.RemoteAddr()) log.Print("Server.Accept: ", conn.RemoteAddr())
} }
NewClient(s, conn)
s.commands <- &NewClientCommand{
conn: conn,
}
} }
} }
@ -534,3 +537,12 @@ func (msg *NoticeCommand) HandleServer(server *Server) {
} }
target.Reply(RplNotice(client, target, msg.message)) target.Reply(RplNotice(client, target, msg.message))
} }
type NewClientCommand struct {
BaseCommand
conn net.Conn
}
func (msg *NewClientCommand) HandleServer(server *Server) {
NewClient(server, conn)
}