From ff5656fdb421a7f789b4e38d0d593fcd05bc5b87 Mon Sep 17 00:00:00 2001 From: Jeremy Latt Date: Sun, 23 Feb 2014 11:08:01 -0800 Subject: [PATCH] aggressively clean up client --- irc/client.go | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/irc/client.go b/irc/client.go index 811504da..cb72e88c 100644 --- a/irc/client.go +++ b/irc/client.go @@ -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) }