Skip to content

Commit d5f7eed

Browse files
austinvazquezdmcgowan
authored andcommitted
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 <[email protected]> (cherry picked from commit 9599fad) Signed-off-by: Derek McGowan <[email protected]>
1 parent e1f0dab commit d5f7eed

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ func (c *serverConn) run(sctx context.Context) {
468468
// branch. Basically, it means that we are no longer receiving
469469
// requests due to a terminal error.
470470
recvErr = nil // connection is now "closing"
471-
if err == io.EOF || err == io.ErrUnexpectedEOF || errors.Is(err, syscall.ECONNRESET) {
471+
if errors.Is(err, io.EOF) || errors.Is(err, io.ErrUnexpectedEOF) || errors.Is(err, syscall.ECONNRESET) {
472472
// The client went away and we should stop processing
473473
// requests, so that the client connection is closed
474474
return

0 commit comments

Comments
 (0)