Skip to content

Commit 02d382e

Browse files
committed
chore: fix misleading SetIdleTimeout comment
Clarify that SetIdleTimeout configures OS-level TCP KeepAlive rather than tracking application-level idle time. The name is kept for backward compatibility.
1 parent bd031f0 commit 02d382e

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎connection.go‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ type Connection interface {
4949
// A zero value for timeout means Writer will not timeout.
5050
SetWriteTimeout(timeout time.Duration) error
5151

52-
// SetIdleTimeout sets the idle timeout of connections.
53-
// Idle connections that exceed the set timeout are no longer guaranteed to be active,
54-
// but can be checked by calling IsActive.
52+
// SetIdleTimeout sets the idle timeout of connections by enabling TCP KeepAlive
53+
// and setting the KeepAlive interval to the given timeout duration.
54+
// NOTE: Despite its name, this does not track application-level idle time.
55+
// It configures OS-level TCP KeepAlive to detect dead peers on idle connections.
56+
// The name is kept for backward compatibility.
5557
SetIdleTimeout(timeout time.Duration) error
5658

5759
// SetOnRequest can set or replace the OnRequest method for a connection, but can't be set to nil.

0 commit comments

Comments
 (0)