Skip to content

Commit 9599fad

Browse files
committed
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]>
1 parent 98b5f64 commit 9599fad

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
@@ -547,7 +547,7 @@ func (c *serverConn) run(sctx context.Context) {
547547
// branch. Basically, it means that we are no longer receiving
548548
// requests due to a terminal error.
549549
recvErr = nil // connection is now "closing"
550-
if err == io.EOF || err == io.ErrUnexpectedEOF || errors.Is(err, syscall.ECONNRESET) {
550+
if errors.Is(err, io.EOF) || errors.Is(err, io.ErrUnexpectedEOF) || errors.Is(err, syscall.ECONNRESET) {
551551
// The client went away and we should stop processing
552552
// requests, so that the client connection is closed
553553
return

0 commit comments

Comments
 (0)