disconnect: Clear callbacks before closing channels
This commit is contained in:
4
irc.go
4
irc.go
@@ -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)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user