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
1 changed files with 1 additions and 8 deletions

View File

@ -107,13 +107,7 @@ func (c *Client) readCommands() {
} }
m.SetClient(c) m.SetClient(c)
if DEBUG_CLIENT {
log.Printf("%s sending %s", c, m)
}
c.server.Command(m) c.server.Command(m)
if DEBUG_CLIENT {
log.Printf("%s sent %s", c, m)
}
} }
c.ConnectionClosed() c.ConnectionClosed()
} }
@ -124,12 +118,11 @@ func (client *Client) writeReplies() {
log.Printf("%s ← %s", client, reply) 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) close(client.replies)
} }
} }
client.replies = nil client.replies = nil
client.ConnectionClosed()
} }
func (client *Client) Destroy() { func (client *Client) Destroy() {