diff --git a/irc.go b/irc.go index 56d7c07..7a3a3b3 100644 --- a/irc.go +++ b/irc.go @@ -317,6 +317,9 @@ func (irc *Connection) Disconnect() { // Reconnect to a server using the current connection. func (irc *Connection) Reconnect() error { + close(irc.end) + irc.Wait() //make sure that wait group is cleared ensuring that all spawned goroutines have completed + irc.end = make(chan struct{}) return irc.Connect(irc.Server) }