3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-22 18:52:41 +01:00

aggressively clean up client

This commit is contained in:
Jeremy Latt 2014-02-23 11:08:01 -08:00
parent 3b56b5bf42
commit ff5656fdb4

View File

@ -183,31 +183,42 @@ func (client *Client) Idle() {
func (client *Client) Register() {
client.phase = Normal
client.loginTimer.Stop()
client.loginTimer = nil
client.Touch()
}
func (client *Client) destroy() {
// clean up self
client.loginTimer.Stop()
if client.idleTimer != nil {
client.idleTimer.Stop()
}
if client.quitTimer != nil {
client.quitTimer.Stop()
}
// clean up channels
for channel := range client.channels {
channel.Quit(client)
}
client.channels = nil
// clean up server
client.server.clients.Remove(client)
// clean up self
if client.loginTimer != nil {
client.loginTimer.Stop()
client.loginTimer = nil
}
if client.idleTimer != nil {
client.idleTimer.Stop()
client.idleTimer = nil
}
if client.quitTimer != nil {
client.quitTimer.Stop()
client.quitTimer = nil
}
client.lookups = nil
client.replies = nil
client.server = nil
client.socket = nil
if DEBUG_CLIENT {
log.Printf("%s: destroyed", client)
}