mirror of
https://github.com/xtaci/kcp-go.git
synced 2024-04-21 12:32:15 +00:00
return always prefer socket errors
This commit is contained in:
@@ -351,14 +351,14 @@ func (s *UDPSession) Close() error {
|
||||
once = true
|
||||
})
|
||||
|
||||
if !once {
|
||||
return errors.New(errClosed)
|
||||
}
|
||||
|
||||
if e := s.socketError.Load(); e != nil {
|
||||
return e.(error)
|
||||
}
|
||||
|
||||
if !once {
|
||||
return errors.New(errClosed)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -843,13 +843,13 @@ func (l *Listener) Close() (err error) {
|
||||
once = true
|
||||
})
|
||||
|
||||
if !once {
|
||||
return errors.New(errClosed)
|
||||
}
|
||||
|
||||
if err := l.socketError.Load(); err != nil {
|
||||
return err.(error)
|
||||
}
|
||||
|
||||
if !once {
|
||||
return errors.New(errClosed)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user