From 5ab0d18898f0259bb7d8305c8bf621e9f5ad7ed6 Mon Sep 17 00:00:00 2001 From: wineandchord Date: Mon, 15 Apr 2024 11:09:31 +0800 Subject: [PATCH] tcpconn: check negative idle timeout to prevent unexpected behaviour (#22) --- CHANGELOG.md | 6 ++++++ tcpconn.go | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 420e6f2..1b9642e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,7 @@ # Change Log + +## v1.0.1 (2024-04-15) + +### Bug Fixes + +- tcpconn: check negative idle timeout to prevent unexpected behaviour (#17) diff --git a/tcpconn.go b/tcpconn.go index e8605b8..d9318b4 100644 --- a/tcpconn.go +++ b/tcpconn.go @@ -502,7 +502,7 @@ func (tc *tcpconn) SetIdleTimeout(d time.Duration) error { if !tc.IsActive() { return ErrConnClosed } - if d == 0 { + if d <= 0 { return nil } if tc.idleTimer != nil {