Added AcceptError function

This commit is contained in:
tidwall 2020-01-20 08:50:30 -07:00
parent a56a5c7c95
commit fc7a9e8758
1 changed files with 6 additions and 0 deletions

View File

@ -327,6 +327,9 @@ func serve(s *Server) error {
if done {
return nil
}
if s.AcceptError != nil {
s.AcceptError(err)
}
continue
}
c := &conn{
@ -532,6 +535,9 @@ type Server struct {
conns map[*conn]bool
ln net.Listener
done bool
// AcceptError is an optional function used to handle Accept errors.
AcceptError func(err error)
}
// TLSServer defines a server for clients for managing client connections.