From: Damien Neil Date: Wed, 19 Nov 2025 19:25:49 +0000 (-0800) Subject: net/http: correctly close fake net.Conns X-Git-Tag: go1.26rc1~229 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=a49b0302d0e1d97b67a5f3f3beceafdcbc4c2ef0;p=gostls13.git net/http: correctly close fake net.Conns Fix an inverted test in fakeNetConn.Close that caused closing a connection to not break the other half of the connection. Change-Id: I4e53f78402f8e503c749d57f294a4524abdccfb5 Reviewed-on: https://go-review.googlesource.com/c/go/+/722220 Reviewed-by: Nicholas Husin Reviewed-by: Nicholas Husin Auto-Submit: Damien Neil LUCI-TryBot-Result: Go LUCI --- diff --git a/src/net/http/netconn_test.go b/src/net/http/netconn_test.go index 52b8069f8b..c5fd61289f 100644 --- a/src/net/http/netconn_test.go +++ b/src/net/http/netconn_test.go @@ -180,9 +180,10 @@ func (c *fakeNetConn) Close() error { c.loc.unlock() // Remote half of the connection reads EOF after reading any remaining data. c.rem.lock() - if c.rem.readErr != nil { + if c.rem.readErr == nil { c.rem.readErr = io.EOF } + c.rem.writeErr = net.ErrClosed c.rem.unlock() if c.autoWait { synctest.Wait()