From c2a009f68ac8f73648b519397ba9c633642f9f38 Mon Sep 17 00:00:00 2001 From: Chunting Gu Date: Thu, 6 Jun 2019 14:02:44 +0800 Subject: [PATCH] Don't log EOF as error. --- webcc/connection.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/webcc/connection.cc b/webcc/connection.cc index 4e5fa65..566fbd5 100644 --- a/webcc/connection.cc +++ b/webcc/connection.cc @@ -65,10 +65,16 @@ void Connection::DoRead() { void Connection::OnRead(boost::system::error_code ec, std::size_t length) { if (ec) { - LOG_ERRO("Socket read error (%s).", ec.message().c_str()); + if (ec == boost::asio::error::eof) { + LOG_WARN("Socket read EOF."); + } else { + LOG_ERRO("Socket read error (%s).", ec.message().c_str()); + } + if (ec != boost::asio::error::operation_aborted) { pool_->Close(shared_from_this()); } + return; }