Skip to content

Commit

Permalink
Expilcity check connection state for each message
Browse files Browse the repository at this point in the history
  • Loading branch information
brattonross committed Oct 1, 2019
1 parent 49e7c07 commit f5479ce
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions client.go
Expand Up @@ -523,17 +523,15 @@ func (c *Client) Join(channels ...string) {

// If we have an active connection, explicitly join
// before we add the joined channels to our map
connActive := c.connActive.get()

c.channelsMtx.Lock()
for _, message := range messages {
if connActive {
if c.connActive.get() {
go c.send(message)
}
}

for _, channel := range joined {
c.channels[channel] = connActive
c.channels[channel] = c.connActive.get()
c.channelUserlistMutex.Lock()
c.channelUserlist[channel] = map[string]bool{}
c.channelUserlistMutex.Unlock()
Expand Down

0 comments on commit f5479ce

Please sign in to comment.