mirror of
https://github.com/golang/go.git
synced 2026-01-29 07:02:05 +03:00
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 <nsh@golang.org> Reviewed-by: Nicholas Husin <husin@google.com> Auto-Submit: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
committed by
Gopher Robot
parent
32f5aadd2f
commit
a49b0302d0
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user