3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-22 03:49:27 +01:00

cancel timers when a client quits

This commit is contained in:
Jeremy Latt 2014-02-09 19:06:30 -08:00
parent 035a8f6cde
commit e625f62baa

View File

@ -103,9 +103,16 @@ func (client *Client) Destroy() error {
if client.replies == nil { if client.replies == nil {
return ErrAlreadyDestroyed return ErrAlreadyDestroyed
} }
close(client.replies) close(client.replies)
client.replies = nil client.replies = nil
client.conn.Close() client.conn.Close()
if client.idleTimer != nil {
client.idleTimer.Stop()
}
if client.quitTimer != nil {
client.quitTimer.Stop()
}
return nil return nil
} }