Skip to content

Commit

Permalink
The shutdown was not terminating: when the goroutine is waiting in s.…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
tbocek committed Sep 28, 2020
1 parent 871b022 commit 0dca787
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0dca787

Please sign in to comment.