disconnect: Clear callbacks before closing channels

This commit is contained in:
Chance Zibolski 2014-07-14 17:05:27 -07:00
parent 846881130f
commit 06fee2df7d

4
irc.go
View File

@ -289,6 +289,10 @@ func (irc *Connection) ErrorChan() chan error {
// A disconnect sends all buffered messages (if possible), // A disconnect sends all buffered messages (if possible),
// stops all goroutines and then closes the socket. // stops all goroutines and then closes the socket.
func (irc *Connection) Disconnect() { func (irc *Connection) Disconnect() {
for event := range irc.events {
irc.ClearCallback(event)
}
close(irc.end) close(irc.end)
close(irc.pwrite) close(irc.pwrite)