grid: Fix a window of a disconnected node not marked as offline (#19703)

LastPong is saved as nanoseconds after a connection or reconnection but
saved as seconds when receiving a pong message. The code deciding if
a pong is too old can be skewed since it assumes LastPong is only in
seconds.
This commit is contained in:
Anis Eleuch 2024-05-09 01:50:13 +01:00 committed by GitHub
parent ec49fff583
commit 67bd71b7a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -867,7 +867,7 @@ func (c *Connection) updateState(s State) {
return
}
if s == StateConnected {
atomic.StoreInt64(&c.LastPong, time.Now().UnixNano())
atomic.StoreInt64(&c.LastPong, time.Now().Unix())
}
atomic.StoreUint32((*uint32)(&c.state), uint32(s))
if debugPrint {