diff --git a/client.go b/client.go index 0abc7025d..924334f30 100644 --- a/client.go +++ b/client.go @@ -323,7 +323,7 @@ func (c *Client) receiveLoop() error { sid := streamID(msg.header.StreamID) s := c.getStream(sid) if s == nil { - logrus.WithField("stream", sid).Errorf("ttrpc: received message on inactive stream") + logrus.WithField("stream", sid).Error("ttrpc: received message on inactive stream") continue } @@ -331,7 +331,7 @@ func (c *Client) receiveLoop() error { s.closeWithError(err) } else { if err := s.receive(c.ctx, msg); err != nil { - logrus.WithError(err).WithField("stream", sid).Errorf("ttrpc: failed to handle message") + logrus.WithError(err).WithField("stream", sid).Error("ttrpc: failed to handle message") } } } diff --git a/server.go b/server.go index 2efda2bc9..098b7e142 100644 --- a/server.go +++ b/server.go @@ -18,13 +18,10 @@ package ttrpc import ( "context" - "errors" - "io" "math/rand" "net" "sync" "sync/atomic" - "syscall" "time" "github.com/sirupsen/logrus" @@ -546,15 +543,13 @@ func (c *serverConn) run(sctx context.Context) { // TODO(stevvooe): Not wildly clear what we should do in this // 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) { - // The client went away and we should stop processing - // requests, so that the client connection is closed - return - } + + // The client went away and we should stop processing + // requests, so that the client connection is closed logrus.WithError(err).Error("error receiving message") - // else, initiate shutdown + return case <-shutdown: + // initiate shutdown return } }