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

don't trigger connection closed on read and write goroutines

This commit is contained in:
Jeremy Latt 2014-02-13 20:30:51 -08:00
parent 03b6caa597
commit e0e61907ce

View File

@ -107,13 +107,7 @@ func (c *Client) readCommands() {
}
m.SetClient(c)
if DEBUG_CLIENT {
log.Printf("%s sending %s", c, m)
}
c.server.Command(m)
if DEBUG_CLIENT {
log.Printf("%s sent %s", c, m)
}
}
c.ConnectionClosed()
}
@ -124,12 +118,11 @@ func (client *Client) writeReplies() {
log.Printf("%s ← %s", client, reply)
}
if err := client.socket.Write(reply.Format(client)); err != nil {
if client.socket.Write(reply.Format(client)) != nil {
close(client.replies)
}
}
client.replies = nil
client.ConnectionClosed()
}
func (client *Client) Destroy() {