chore(http): ignore ErrServerClosed error (#505)

This commit is contained in:
Bo-Yi Wu 2020-04-27 17:08:12 +08:00 committed by GitHub
parent 7dbb5c98e7
commit 52c2301b3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -81,7 +81,10 @@ func listenAndServe(ctx context.Context, s *http.Server) error {
}
})
g.Go(func() error {
return s.ListenAndServe()
if err := s.ListenAndServe(); err != nil && err != http.ErrServerClosed {
return err
}
return nil
})
return g.Wait()
}
@ -98,7 +101,10 @@ func listenAndServeTLS(ctx context.Context, s *http.Server) error {
}
})
g.Go(func() error {
return s.ListenAndServeTLS("", "")
if err := s.ListenAndServeTLS("", ""); err != nil && err != http.ErrServerClosed {
return err
}
return nil
})
return g.Wait()
}