]> Cypherpunks.ru repositories - gostls13.git/commit
net/http: wait for listeners to exit in Server.Close and Shutdown
authorDamien Neil <dneil@google.com>
Tue, 31 May 2022 21:47:33 +0000 (14:47 -0700)
committerDamien Neil <dneil@google.com>
Fri, 8 Jul 2022 17:00:50 +0000 (17:00 +0000)
commit180bcad33dcd3d59443fe8eda5ae7556b1b2945b
treecb15663467e781bc3738c92fb99ca7dc3238b720
parent14abe8aa7324bdf0e09e1dfebfb3519cc30f4918
net/http: wait for listeners to exit in Server.Close and Shutdown

Avoid race conditions when a new connection is accepted just after
Server.Close or Server.Shutdown is called by waiting for the
listener goroutines to exit before proceeding to clean up active
connections.

No test because the mechanism required to trigger the race condition
reliably requires such tight coupling to the Server internals that
any test would be quite fragile in the face of reasonable refactorings.

Fixes #48642
Updates #33313, #36819

Change-Id: I109a93362680991bf298e0a95637595dcaa884af
Reviewed-on: https://go-review.googlesource.com/c/go/+/409537
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
src/net/http/server.go