diff --git a/lib/eof.go b/lib/eof.go index f77844fd64..75408c8c0d 100644 --- a/lib/eof.go +++ b/lib/eof.go @@ -1,6 +1,7 @@ package lib import ( + "errors" "io" "strings" @@ -13,13 +14,14 @@ var yamuxSessionShutdown = yamux.ErrSessionShutdown.Error() // IsErrEOF returns true if we get an EOF error from the socket itself, or // an EOF equivalent error from yamux. func IsErrEOF(err error) bool { - if err == io.EOF { + if errors.Is(err, io.EOF) { return true } errStr := err.Error() if strings.Contains(errStr, yamuxStreamClosed) || - strings.Contains(errStr, yamuxSessionShutdown) { + strings.Contains(errStr, yamuxSessionShutdown) || + strings.HasSuffix(errStr, io.EOF.Error()) { return true }