From 06fee2df7d48a003b45505f9fdae099252742579 Mon Sep 17 00:00:00 2001 From: Chance Zibolski Date: Mon, 14 Jul 2014 17:05:27 -0700 Subject: [PATCH] disconnect: Clear callbacks before closing channels --- irc.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/irc.go b/irc.go index b29fce8..306b061 100644 --- a/irc.go +++ b/irc.go @@ -289,6 +289,10 @@ func (irc *Connection) ErrorChan() chan error { // A disconnect sends all buffered messages (if possible), // stops all goroutines and then closes the socket. func (irc *Connection) Disconnect() { + for event := range irc.events { + irc.ClearCallback(event) + } + close(irc.end) close(irc.pwrite)