server: Avoid creating a new Listener after Close
This commit is contained in:
parent
f158bb5f1d
commit
a05fa6d6bd
@ -117,6 +117,10 @@ func (srv *Server) HandleFunc(pattern string, handler func(ResponseWriter, *Requ
|
||||
// ListenAndServe always returns a non-nil error. After Shutdown or Close, the
|
||||
// returned error is ErrServerClosed.
|
||||
func (srv *Server) ListenAndServe() error {
|
||||
if atomic.LoadInt32(&srv.done) == 1 {
|
||||
return ErrServerClosed
|
||||
}
|
||||
|
||||
addr := srv.Addr
|
||||
if addr == "" {
|
||||
addr = ":1965"
|
||||
|
Loading…
Reference in New Issue
Block a user