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

View File

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