Skip to content

Commit

Permalink
event: another dirty fix for another data race
Browse files Browse the repository at this point in the history
Related to #511.
  • Loading branch information
fsouza committed Apr 26, 2016
1 parent c21dd8b commit ca798d0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion event.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,12 @@ func (c *Client) eventHijack(startTime int64, eventChan chan *APIEvents, errChan
var event APIEvents
if err = decoder.Decode(&event); err != nil {
if err == io.EOF || err == io.ErrUnexpectedEOF {
if c.eventMonitor.isEnabled() && c.eventMonitor.C == eventChan {
c.eventMonitor.RLock()
if c.eventMonitor.enabled && c.eventMonitor.C == eventChan {
// Signal that we're exiting.
eventChan <- EOFEvent
}
c.eventMonitor.RUnlock()
break
}
errChan <- err
Expand Down

0 comments on commit ca798d0

Please sign in to comment.