]> Cypherpunks repositories - gostls13.git/commit
net: use context.AfterFunc in connect
authordatabase64128 <free122448@hotmail.com>
Wed, 27 Aug 2025 09:38:13 +0000 (17:38 +0800)
committerGopher Robot <gobot@golang.org>
Mon, 15 Sep 2025 00:12:25 +0000 (17:12 -0700)
commit080882a928c96f997a1cb67cef40d2cc6126ffcd
tree36b056b288b7570e4c4bb5f4c37ae5667bf31e1b
parentac803b5949f6dbc5bfa559afe506d35f9e1b3195
net: use context.AfterFunc in connect

This saves a goroutine when ctx can be but is not canceled during
the connect call.

The redundant fd.Close() call is removed, because the caller closes
the fd on error.

Change-Id: I124d7e480294a48ef74d5650d8ef0489bdfc64d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/699256
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Reviewed-by: Mark Freeman <markfreeman@google.com>
src/net/fd_unix.go