]> Cypherpunks repositories - gostls13.git/commit
net: unify TCP keepalive behavior
authordatabase64128 <free122448@hotmail.com>
Thu, 10 Nov 2022 08:20:29 +0000 (08:20 +0000)
committerGopher Robot <gobot@golang.org>
Thu, 10 Nov 2022 18:46:00 +0000 (18:46 +0000)
commitfbf763fd1d6be3c162ea5ff3c8843171ef937c3a
treea79a75ac7b484ccc6da92f6f9be8d0df49405642
parent531ba0c8aae9efe25e33bf0bfa40f4941d8c5ab8
net: unify TCP keepalive behavior

CL 107196 introduced a default TCP keepalive interval for Dialer and TCPListener (used by both ListenConfig and ListenTCP). Leaving DialTCP out was likely an oversight.

DialTCP's documentation says it "acts like Dial". Therefore it's natural to also expect DialTCP to enable TCP keepalive by default.

This commit addresses this disparity by moving the enablement logic down to the newTCPConn function, which is used by both dialer and listener.

Fixes #49345

Change-Id: I99c08b161c468ed0b993d1dbd2bd0d7e803f3826
GitHub-Last-Rev: 5c2f1cb0fbc5e83aa6cdbdf3ed4e23419d9bca65
GitHub-Pull-Request: golang/go#56565
Reviewed-on: https://go-review.googlesource.com/c/go/+/447917
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
src/net/dial.go
src/net/file_plan9.go
src/net/file_unix.go
src/net/tcpsock.go
src/net/tcpsock_plan9.go
src/net/tcpsock_posix.go
src/net/tcpsock_test.go