Merge pull request #60 from dainis/master

Fix - wait for waitgroup to sync before reconnecting
This commit is contained in:
Thomas Jager 2015-07-30 12:46:56 +02:00
commit 2c74703554

3
irc.go
View File

@ -317,6 +317,9 @@ func (irc *Connection) Disconnect() {
// Reconnect to a server using the current connection. // Reconnect to a server using the current connection.
func (irc *Connection) Reconnect() error { 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{}) irc.end = make(chan struct{})
return irc.Connect(irc.Server) return irc.Connect(irc.Server)
} }