Wrap more error

This commit is contained in:
世界 2022-08-03 19:21:46 +08:00
parent a116134e5b
commit a8fd6450d4
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -48,9 +48,9 @@ func (c *gUDPConn) Write(b []byte) (n int, err error) {
func wrapStackError(err tcpip.Error) error { func wrapStackError(err tcpip.Error) error {
switch err.(type) { switch err.(type) {
case *tcpip.ErrClosedForSend: case *tcpip.ErrClosedForSend,
return net.ErrClosed *tcpip.ErrClosedForReceive,
case *tcpip.ErrClosedForReceive: *tcpip.ErrAborted:
return net.ErrClosed return net.ErrClosed
} }
return wrapStackError(err) return wrapStackError(err)
@ -59,9 +59,9 @@ func wrapStackError(err tcpip.Error) error {
func wrapError(err error) error { func wrapError(err error) error {
if opErr, isOpErr := err.(*net.OpError); isOpErr { if opErr, isOpErr := err.(*net.OpError); isOpErr {
switch opErr.Err.Error() { switch opErr.Err.Error() {
case "endpoint is closed for send": case "endpoint is closed for send",
return net.ErrClosed "endpoint is closed for receive",
case "endpoint is closed for receive": "operation aborted":
return net.ErrClosed return net.ErrClosed
} }
} }