lib/vmselectapi: properly check for net.ErrClosed

This error may be wrapped in another error, and should normally be tested using
`errors.Is(err, net.ErrClosed)`.

Signed-off-by: hagen1778 <roman@victoriametrics.com>
This commit is contained in:
hagen1778 2023-06-09 10:42:03 +02:00
parent d677c2a5a6
commit dde01c826d
No known key found for this signature in database
GPG key ID: 3BF75F3741CA9640

View file

@ -257,7 +257,7 @@ func (s *Server) processConn(bc *handshake.BufferedConn) error {
// Remote client gracefully closed the connection.
return nil
}
if err == net.ErrClosed || strings.Contains(err.Error(), "broken pipe") {
if errors.Is(err, net.ErrClosed) || strings.Contains(err.Error(), "broken pipe") {
// The connection has been interrupted abruptly.
// It could happen due to unexpected network glitch or because connection was
// interrupted by remote client. In both cases, remote client will notice