From e6e694b43b513134ed41a829767a2aa6d451fc55 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Sat, 7 Jan 2023 20:04:05 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9B=86=E7=BE=A4=E6=9C=8D=E5=8A=A1=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=8A=A8=E8=AF=BB=E8=B6=85?= =?UTF-8?q?=E6=97=B6=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/client_conn.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/nodes/client_conn.go b/internal/nodes/client_conn.go index 3a98216..197f284 100644 --- a/internal/nodes/client_conn.go +++ b/internal/nodes/client_conn.go @@ -93,7 +93,8 @@ func (this *ClientConn) Read(b []byte) (n int, err error) { } // 设置读超时时间 - if this.isHTTP && !this.isShortReading { + var autoReadTimeout = globalServerConfig != nil && globalServerConfig.Performance.AutoReadTimeout + if this.isHTTP && !this.isShortReading && autoReadTimeout { this.setHTTPReadTimeout() } @@ -214,7 +215,9 @@ func (this *ClientConn) SetDeadline(t time.Time) error { } func (this *ClientConn) SetReadDeadline(t time.Time) error { - if this.isHTTP { + // 如果开启了HTTP自动读超时选项,则自动控制超时时间 + var globalServerConfig = sharedNodeConfig.GlobalServerConfig + if this.isHTTP && globalServerConfig != nil && globalServerConfig.Performance.AutoReadTimeout { this.isShortReading = false var unixTime = t.Unix()