aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2019-08-09 13:48:34 -0700
committerIan Lance Taylor <iant@golang.org>2019-08-11 15:44:08 +0000
commit8b058cfbcec5dc3002ddd6cedc7070ff946b2257 (patch)
treed557a58f753ba50806731fa63d9fda7c67cce57e
parent2754118731b81baf0c812116a9b72b6153abf79d (diff)
downloadgo-8b058cfbcec5dc3002ddd6cedc7070ff946b2257.tar.gz
go-8b058cfbcec5dc3002ddd6cedc7070ff946b2257.zip
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 <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> Reviewed-by: Filippo Valsorda <filippo@golang.org>
-rw-r--r--src/net/net.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/net/net.go b/src/net/net.go
index 4ed40237a8..38c6b99637 100644
--- a/src/net/net.go
+++ b/src/net/net.go
@@ -146,6 +146,13 @@ type Conn interface {
// the deadline after successful Read or Write calls.
//
// A zero value for t means I/O operations will not time out.
+ //
+ // Note that if a TCP connection has keep-alive turned on,
+ // which is the default unless overridden by Dialer.KeepAlive
+ // or ListenConfig.KeepAlive, then a keep-alive failure may
+ // also return a timeout error. On Unix systems a keep-alive
+ // failure on I/O can be detected using
+ // errors.Is(err, syscall.ETIMEDOUT).
SetDeadline(t time.Time) error
// SetReadDeadline sets the deadline for future Read calls