Protect writes to DataReady with mutex lock

This commit is contained in:
Bruce Marriner 2016-06-17 14:23:19 -05:00
parent 6c4d9f0ad7
commit 11f11de41c

View file

@ -194,10 +194,14 @@ func (s *Session) heartbeat(wsConn *websocket.Conn, listening <-chan interface{}
s.wsMutex.Unlock()
if err != nil {
s.log(LogError, "error sending heartbeat to gateway %s, %s", s.gateway, err)
s.Lock()
s.DataReady = false
s.Unlock()
return
}
s.Lock()
s.DataReady = true
s.Unlock()
select {
case <-ticker.C: