Merge pull request #60 from dainis/master
Fix - wait for waitgroup to sync before reconnecting
This commit is contained in:
commit
2c74703554
3
irc.go
3
irc.go
@ -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)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user