Skip to content

Commit

Permalink
Don't log connection write errors
Browse files Browse the repository at this point in the history
Since they are part of the normal flow (i.e. a client closed the
connection), they provide no useful information.
  • Loading branch information
agis committed May 16, 2019
1 parent 5039aeb commit 686af22
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,15 +319,16 @@ func (s *Server) Handle(ctx context.Context, conn net.Conn) {
}
}
if parseErr != nil || command.IsLast() {
err := writer.Flush()
if err != nil {
s.log.Println("Error flushing response:", err)
}
writer.Flush()
}
if parseErr != nil || writeErr != nil {
if writeErr != nil {
s.log.Println("Error writing response:", writeErr)
}
// parse errors are returned to the client and write
// errors are non-issues, since they just indicate
// the client closed the connection. That's why
// we don't log anything.
//
// Instead, we close the connection. Clients should
// establish the connections anew if needed.
break
}
}
Expand Down

0 comments on commit 686af22

Please sign in to comment.