Fix possible data race (irc). Closes #693

This commit is contained in:
Wim 2019-01-24 21:51:52 +01:00
parent e3cb665d92
commit 8548b69e6e

View File

@ -85,10 +85,10 @@ func (b *Birc) Connect() error {
i.Handlers.Add(girc.RPL_WELCOME, b.handleNewConnection) i.Handlers.Add(girc.RPL_WELCOME, b.handleNewConnection)
i.Handlers.Add(girc.RPL_ENDOFMOTD, b.handleOtherAuth) i.Handlers.Add(girc.RPL_ENDOFMOTD, b.handleOtherAuth)
i.Handlers.Add(girc.ALL_EVENTS, b.handleOther) i.Handlers.Add(girc.ALL_EVENTS, b.handleOther)
b.i = i
go b.doConnect() go b.doConnect()
b.i = i
err = <-b.connected err = <-b.connected
if err != nil { if err != nil {
return fmt.Errorf("connection failed %s", err) return fmt.Errorf("connection failed %s", err)