From 9599fadcd66ef7b6a3aec840be59a3a38203bc2c Mon Sep 17 00:00:00 2001 From: Austin Vazquez Date: Tue, 2 May 2023 15:40:45 +0000 Subject: [PATCH] Unwrap io errors in server connection receive error handling Unwrap io.EOF and io.ErrUnexpectedEOF in the case of read message error which would lead to leaked server connections. Signed-off-by: Austin Vazquez --- server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.go b/server.go index 2efda2bc9..7af59f828 100644 --- a/server.go +++ b/server.go @@ -547,7 +547,7 @@ func (c *serverConn) run(sctx context.Context) { // branch. Basically, it means that we are no longer receiving // requests due to a terminal error. recvErr = nil // connection is now "closing" - if err == io.EOF || err == io.ErrUnexpectedEOF || errors.Is(err, syscall.ECONNRESET) { + if errors.Is(err, io.EOF) || errors.Is(err, io.ErrUnexpectedEOF) || errors.Is(err, syscall.ECONNRESET) { // The client went away and we should stop processing // requests, so that the client connection is closed return