From c567404b7a20f2264801276f1375d22a191d8eac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Thu, 5 Jan 2023 11:13:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=BF=9E=E6=8E=A5=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/client_conn.go | 6 +++++- internal/nodes/node.go | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/internal/nodes/client_conn.go b/internal/nodes/client_conn.go index 7b32053..e8be4c3 100644 --- a/internal/nodes/client_conn.go +++ b/internal/nodes/client_conn.go @@ -222,7 +222,11 @@ func (this *ClientConn) SetReadDeadline(t time.Time) error { return nil } this.readDeadlineTime = unixTime - if -time.Since(t) < HTTPIdleTimeout-1*time.Second { + var seconds = -time.Since(t) + if seconds <= 0 || seconds > HTTPIdleTimeout { + return nil + } + if seconds < HTTPIdleTimeout-1*time.Second { this.isShortReading = true } } diff --git a/internal/nodes/node.go b/internal/nodes/node.go index cd24fd4..857f5c1 100644 --- a/internal/nodes/node.go +++ b/internal/nodes/node.go @@ -898,9 +898,9 @@ func (this *Node) listenSock() error { lastErrString = lastErr.Error() } } - var age int64 - var lastReadAge int64 - var lastWriteAge int64 + var age int64 = -1 + var lastReadAge int64 = -1 + var lastWriteAge int64 = -1 var currentTime = time.Now().Unix() if createdAt > 0 { age = currentTime - createdAt