Add ENOTCONN to IsClosed

This commit is contained in:
世界 2025-02-05 09:47:22 +08:00
parent d9f6eb136d
commit d8153df67f
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -40,11 +40,11 @@ func Extend(cause error, message ...any) error {
} }
func IsClosedOrCanceled(err error) bool { func IsClosedOrCanceled(err error) bool {
return IsMulti(err, io.EOF, net.ErrClosed, io.ErrClosedPipe, os.ErrClosed, syscall.EPIPE, syscall.ECONNRESET, context.Canceled, context.DeadlineExceeded) || IsTimeout(err) return IsClosed(err) || IsCanceled(err) || IsTimeout(err)
} }
func IsClosed(err error) bool { func IsClosed(err error) bool {
return IsMulti(err, io.EOF, net.ErrClosed, io.ErrClosedPipe, os.ErrClosed, syscall.EPIPE, syscall.ECONNRESET) return IsMulti(err, io.EOF, net.ErrClosed, io.ErrClosedPipe, os.ErrClosed, syscall.EPIPE, syscall.ECONNRESET, syscall.ENOTCONN)
} }
func IsCanceled(err error) bool { func IsCanceled(err error) bool {