From d5c9681a10d429a98691b8632c6015d8fe97f15b Mon Sep 17 00:00:00 2001 From: Jeremy Latt Date: Sun, 16 Feb 2014 22:30:01 -0800 Subject: [PATCH] instantiate clients in the server command goroutine --- irc/server.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/irc/server.go b/irc/server.go index 2e0764ea..82e00481 100644 --- a/irc/server.go +++ b/irc/server.go @@ -122,7 +122,10 @@ func (s *Server) listen(config ListenerConfig) { if DEBUG_SERVER { 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)) } + +type NewClientCommand struct { + BaseCommand + conn net.Conn +} + +func (msg *NewClientCommand) HandleServer(server *Server) { + NewClient(server, conn) +}