diff --git a/event.go b/event.go index 60eb0338..120cdc9b 100644 --- a/event.go +++ b/event.go @@ -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