aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2019-08-02 13:17:59 -0700
committerIan Lance Taylor <iant@golang.org>2019-08-02 21:03:47 +0000
commit55e23cb1fe18c6784b573a44bce4c798a1983c2f (patch)
tree850846942768b2849a3fe408ace1e7d3c098c8a0
parent07b3e629cedb518533407628b64fe6fc96f5a9e4 (diff)
downloadgo-55e23cb1fe18c6784b573a44bce4c798a1983c2f.tar.gz
go-55e23cb1fe18c6784b573a44bce4c798a1983c2f.zip
doc/go1.13: mention confusion between keep-alive timeout and deadline
Updates #31449 Change-Id: I4d7075b20cd8171bc792e40b388f4215264a3317 Reviewed-on: https://go-review.googlesource.com/c/go/+/188819 Reviewed-by: Filippo Valsorda <filippo@golang.org>
-rw-r--r--doc/go1.13.html18
1 files changed, 18 insertions, 0 deletions
diff --git a/doc/go1.13.html b/doc/go1.13.html
index c79a76f4b8..34a2d5e043 100644
--- a/doc/go1.13.html
+++ b/doc/go1.13.html
@@ -707,6 +707,24 @@ godoc
<p><!-- CL 170678 -->
The new field <a href="/pkg/net/#ListenConfig.KeepAlive"><code>ListenConfig.KeepAlive</code></a>
specifies the keep-alive period for network connections accepted by the listener.
+ If this field is 0 (the default) TCP keep-alives will be enabled.
+ To disable them, set it to a negative value.
+ </p>
+ <p>
+ Note that the error returned from I/O on a connection that was
+ closed by a keep-alive timeout will have a
+ <code>Timeout</code> method that returns <code>true</code> if called.
+ This can make a keep-alive error difficult to distinguish from
+ an error returned due to a missed deadline as set by the
+ <a href="/pkg/net#Conn"><code>SetDeadline</code></a>
+ method and similar methods.
+ Code that uses deadlines and checks for them with
+ the <code>Timeout</code> method or
+ with <a href="/pkg/os/#IsTimeout"><code>os.IsTimeout</code></a>
+ may want to disable keep-alives, or
+ use <code>errors.Is(syscall.ETIMEDOUT)</code> (on Unix systems)
+ which will return true for a keep-alive timeout and false for a
+ deadline timeout.
</p>
</dl><!-- net -->