Skip to content

Commit

Permalink
chore(http): ignore ErrServerClosed error (#505)
Browse files Browse the repository at this point in the history
  • Loading branch information
appleboy authored Apr 27, 2020
1 parent 7dbb5c9 commit 52c2301
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions gorush/server_normal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand All @@ -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()
}
Expand Down

0 comments on commit 52c2301

Please sign in to comment.