Skip to content

Commit

Permalink
event: fix race in event monitoring code
Browse files Browse the repository at this point in the history
  • Loading branch information
fsouza committed Jul 26, 2017
1 parent 98f886e commit 57f271a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions event.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,11 +342,12 @@ func (c *Client) eventHijack(startTime int64, eventChan chan *APIEvents, errChan
if event.Time == 0 {
continue
}
if !c.eventMonitor.isEnabled() || c.eventMonitor.C != eventChan {
return
}
transformEvent(&event)
eventChan <- &event
c.eventMonitor.RLock()
if c.eventMonitor.enabled && c.eventMonitor.C == eventChan {
eventChan <- &event
}
c.eventMonitor.RUnlock()
}
}(res, conn)
return nil
Expand Down

0 comments on commit 57f271a

Please sign in to comment.