Skip to content

Commit

Permalink
error_code log
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyoko-Jeremie committed Sep 2, 2023
1 parent 2819794 commit 2ad04d8
Showing 1 changed file with 26 additions and 13 deletions.
39 changes: 26 additions & 13 deletions src/TcpRelaySession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,12 @@ void TcpRelaySession::do_upstream_read() {
// write it to server
do_downstream_write(bytes_transferred);
} else {
BOOST_LOG_S5B_ID(relayId, trace)
<< "TcpRelaySession do_upstream_read call close(error) error:"
<< error.what();
if (error != boost::asio::error::operation_aborted &&
error != boost::asio::error::eof) {
BOOST_LOG_S5B_ID(relayId, trace)
<< "TcpRelaySession do_upstream_read call close(error) error:"
<< error.what();
}
close(error);
}
});
Expand All @@ -343,9 +346,12 @@ void TcpRelaySession::do_downstream_write(const size_t &bytes_transferred) {
// read more again
do_upstream_read();
} else {
BOOST_LOG_S5B_ID(relayId, trace)
<< "TcpRelaySession do_downstream_write call close(error) error:"
<< error.what();
if (error != boost::asio::error::operation_aborted &&
error != boost::asio::error::eof) {
BOOST_LOG_S5B_ID(relayId, trace)
<< "TcpRelaySession do_downstream_write call close(error) error:"
<< error.what();
}
close(error);
}
});
Expand Down Expand Up @@ -386,9 +392,12 @@ void TcpRelaySession::do_downstream_read() {
// write it to server
do_upstream_write(bytes_transferred);
} else {
BOOST_LOG_S5B_ID(relayId, trace)
<< "TcpRelaySession do_downstream_read call close(error) error:"
<< error.what();
if (error != boost::asio::error::operation_aborted &&
error != boost::asio::error::eof) {
BOOST_LOG_S5B_ID(relayId, trace)
<< "TcpRelaySession do_downstream_read call close(error) error:"
<< error.what();
}
close(error);
}
});
Expand All @@ -407,16 +416,20 @@ void TcpRelaySession::do_upstream_write(const size_t &bytes_transferred) {
// read more again
do_downstream_read();
} else {
BOOST_LOG_S5B_ID(relayId, trace)
<< "TcpRelaySession do_upstream_write call close(error) error:"
<< error.what();
if (error != boost::asio::error::operation_aborted &&
error != boost::asio::error::eof) {
BOOST_LOG_S5B_ID(relayId, trace)
<< "TcpRelaySession do_upstream_write call close(error) error:"
<< error.what();
}
close(error);
}
});
}

void TcpRelaySession::close(boost::system::error_code error) {
if (error == boost::asio::error::eof) {
if (error == boost::asio::error::eof ||
error != boost::asio::error::operation_aborted) {
// Rationale:
// http://stackoverflow.com/questions/25587403/boost-asio-ssl-async-shutdown-always-finishes-with-an-error
error = {};
Expand Down

0 comments on commit 2ad04d8

Please sign in to comment.