From 0dca787dbfcbcdeb4f18c59c125222343fd59656 Mon Sep 17 00:00:00 2001 From: Thomas Bocek Date: Mon, 28 Sep 2020 15:45:14 +0200 Subject: [PATCH] The shutdown was not terminating: when the goroutine is waiting in s.Listener.Accept, and a shutdown is initiated with serverLdap.Stop() and followed by a serverLdap.Listener.Close(), the s.Listener.Accept returns an connection closed error, which is not a timeout. By changing to || in this statement, a close will go into the select/case statement and properly terminate. --- server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.go b/server.go index a9f5dd1..149dadb 100644 --- a/server.go +++ b/server.go @@ -91,7 +91,7 @@ func (s *Server) serve() error { rw.SetWriteDeadline(time.Now().Add(s.WriteTimeout)) } if nil != err { - if opErr, ok := err.(*net.OpError); ok && opErr.Timeout() { + if opErr, ok := err.(*net.OpError); ok || opErr.Timeout() { continue } Logger.Println(err)