Fixes #17878
Change-Id: I062ac514239068c58175c9ee7964b3590f956a82
Reviewed-on: https://go-review.googlesource.com/33026
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
t.Fatal("second request should fail. server should be shut down")
}
}
+
+// Issue 17878: tests that we can call Close twice.
+func TestServerCloseDeadlock(t *testing.T) {
+ var s Server
+ s.Close()
+ s.Close()
+}
// regardless of their state. For a graceful shutdown, use Shutdown.
func (s *Server) Close() error {
s.mu.Lock()
- defer s.mu.Lock()
+ defer s.mu.Unlock()
s.closeDoneChanLocked()
err := s.closeListenersLocked()
for c := range s.activeConn {