Skip to content

Commit 8b058cf

Browse files
net: document that a keep-alive failure also returns a timeout
Updates #31449 Change-Id: I76490c5e83eb2f7ba529b387a57ba088428aece5 Reviewed-on: https://go-review.googlesource.com/c/go/+/189757 Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Emmanuel Odeke <[email protected]> Reviewed-by: Filippo Valsorda <[email protected]>
1 parent 2754118 commit 8b058cf

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/net/net.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,13 @@ type Conn interface {
146146
// the deadline after successful Read or Write calls.
147147
//
148148
// A zero value for t means I/O operations will not time out.
149+
//
150+
// Note that if a TCP connection has keep-alive turned on,
151+
// which is the default unless overridden by Dialer.KeepAlive
152+
// or ListenConfig.KeepAlive, then a keep-alive failure may
153+
// also return a timeout error. On Unix systems a keep-alive
154+
// failure on I/O can be detected using
155+
// errors.Is(err, syscall.ETIMEDOUT).
149156
SetDeadline(t time.Time) error
150157

151158
// SetReadDeadline sets the deadline for future Read calls

0 commit comments

Comments
 (0)