From 911c9cda77ee36640c4c13350cdad7ec592b0a72 Mon Sep 17 00:00:00 2001 From: Georgi Sabev Date: Mon, 13 May 2019 10:36:03 +0100 Subject: [PATCH] Improve connection error handling Return if client is gone, log all other errors Co-authored-by: Giuseppe Capizzi Signed-off-by: Georgi Sabev --- server.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server.go b/server.go index 1431251..dc605f4 100644 --- a/server.go +++ b/server.go @@ -449,14 +449,14 @@ 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 != nil && err != io.EOF { - logrus.WithError(err).Error("error receiving message") - } if err == io.EOF || err == io.ErrUnexpectedEOF { // The client went away and we should stop processing // requests, so that the client connection is closed return } + if err != nil { + logrus.WithError(err).Error("error receiving message") + } case <-shutdown: return }