Merge pull request #38 from masters-of-cats/pr-client-eof-improvement

Improve connection error handling
This commit is contained in:
Brian Goff 2019-05-13 07:15:51 -07:00 committed by GitHub
commit f82148331a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -449,14 +449,14 @@ func (c *serverConn) run(sctx context.Context) {
// branch. Basically, it means that we are no longer receiving // branch. Basically, it means that we are no longer receiving
// requests due to a terminal error. // requests due to a terminal error.
recvErr = nil // connection is now "closing" 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 { if err == io.EOF || err == io.ErrUnexpectedEOF {
// The client went away and we should stop processing // The client went away and we should stop processing
// requests, so that the client connection is closed // requests, so that the client connection is closed
return return
} }
if err != nil {
logrus.WithError(err).Error("error receiving message")
}
case <-shutdown: case <-shutdown:
return return
} }