3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-10 22:19:31 +01:00

only quit registered clients

This commit is contained in:
Jeremy Latt 2014-02-13 20:52:42 -08:00
parent dcc40bbac1
commit be01a412d9
2 changed files with 11 additions and 8 deletions

View File

@ -113,7 +113,12 @@ func (c *Client) readCommands() {
m.SetClient(c)
c.server.Command(m)
}
c.ConnectionClosed()
if c.registered {
c.ConnectionClosed()
} else {
c.Destroy()
}
}
func (client *Client) writeReplies() {

View File

@ -65,10 +65,6 @@ func (server *Server) receiveCommands() {
client.Touch()
command.HandleServer(server)
if DEBUG_SERVER {
log.Printf("%s → %s %+v processed", command.Client(), server, command)
}
}
}
@ -311,9 +307,11 @@ func (m *QuitCommand) HandleServer(server *Server) {
client.Reply(RplError(server, client))
client.Destroy()
reply := RplQuit(client, m.message)
for iclient := range iclients {
iclient.Reply(reply)
if len(iclients) > 0 {
reply := RplQuit(client, m.message)
for iclient := range iclients {
iclient.Reply(reply)
}
}
}