Skip to content

Commit

Permalink
Dont log error in case of eof error for async_read
Browse files Browse the repository at this point in the history
async_read returns eof to indicate that the other side has closed the socket.
This is a way for other side to know that socket should be closed now. There
is no need to log since it is not an error condition

Closes-Bug: 1506795

Change-Id: I5dc5dc0cb9a909d97dacff8ceef89c863a7536c7
(cherry picked from commit ef96e3d)
  • Loading branch information
bansalnikhil committed Nov 24, 2015
1 parent 85837b5 commit 4c4b398
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/io/tcp_session.cc
Expand Up @@ -427,9 +427,12 @@ void TcpSession::AsyncReadHandler(

if (IsSocketErrorHard(error)) {
session->ReleaseBufferLocked(buffer);
TCP_SESSION_LOG_ERROR(session, TCP_DIR_IN,
// eof is returned when the peer closed the socket, no need to log err
if (error != error::eof) {
TCP_SESSION_LOG_ERROR(session, TCP_DIR_IN,
"Read failed due to error " << error.value()
<< " : " << error.message());
}
lock.release();
session->CloseInternal(error, true);
return;
Expand All @@ -440,9 +443,12 @@ void TcpSession::AsyncReadHandler(
// check error code if session needs to be closed
if (IsSocketErrorHard(err)) {
session->ReleaseBufferLocked(buffer);
TCP_SESSION_LOG_ERROR(session, TCP_DIR_IN,
// eof is returned when the peer has closed the socket
if (error != error::eof) {
TCP_SESSION_LOG_ERROR(session, TCP_DIR_IN,
"Read failed due to error " << err.value()
<< " : " << err.message());
}
lock.release();
session->CloseInternal(err, true);
return;
Expand Down

0 comments on commit 4c4b398

Please sign in to comment.