From 67bd71b7a5a05dbc185559635369aba21bd0b2d6 Mon Sep 17 00:00:00 2001 From: Anis Eleuch Date: Thu, 9 May 2024 01:50:13 +0100 Subject: [PATCH] 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. --- internal/grid/connection.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/grid/connection.go b/internal/grid/connection.go index 0d13372de..72925c5d2 100644 --- a/internal/grid/connection.go +++ b/internal/grid/connection.go @@ -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 {