Browse Source

don't print error message if operation cancelled

pull/2016/head
orignal 10 months ago
parent
commit
b07530a8a1
  1. 40
      libi2pd_client/I2PService.cpp

40
libi2pd_client/I2PService.cpp

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2023, The PurpleI2P Project * Copyright (c) 2013-2024, The PurpleI2P Project
* *
* This file is part of Purple i2pd project and licensed under BSD3 * This file is part of Purple i2pd project and licensed under BSD3
* *
@ -239,56 +239,70 @@ namespace client
void TCPIPPipe::HandleDownstreamReceived(const boost::system::error_code & ecode, std::size_t bytes_transfered) void TCPIPPipe::HandleDownstreamReceived(const boost::system::error_code & ecode, std::size_t bytes_transfered)
{
if (ecode != boost::asio::error::operation_aborted)
{ {
LogPrint(eLogDebug, "TCPIPPipe: Downstream: ", (int) bytes_transfered, " bytes received"); LogPrint(eLogDebug, "TCPIPPipe: Downstream: ", (int) bytes_transfered, " bytes received");
if (ecode) if (ecode)
{ {
LogPrint(eLogError, "TCPIPPipe: Downstream read error:" , ecode.message()); LogPrint(eLogWarning, "TCPIPPipe: Downstream read error:" , ecode.message());
if (ecode != boost::asio::error::operation_aborted)
Terminate(); Terminate();
} else { }
else
{
if (bytes_transfered > 0 ) if (bytes_transfered > 0 )
memcpy(m_upstream_buf, m_downstream_to_up_buf, bytes_transfered); memcpy(m_upstream_buf, m_downstream_to_up_buf, bytes_transfered);
UpstreamWrite(bytes_transfered); UpstreamWrite(bytes_transfered);
} }
} }
}
void TCPIPPipe::HandleDownstreamWrite(const boost::system::error_code & ecode) { void TCPIPPipe::HandleDownstreamWrite(const boost::system::error_code & ecode)
if (ecode)
{ {
LogPrint(eLogError, "TCPIPPipe: Downstream write error:" , ecode.message());
if (ecode != boost::asio::error::operation_aborted) if (ecode != boost::asio::error::operation_aborted)
{
if (ecode)
{
LogPrint(eLogWarning, "TCPIPPipe: Downstream write error:" , ecode.message());
Terminate(); Terminate();
} }
else else
AsyncReceiveUpstream(); AsyncReceiveUpstream();
} }
}
void TCPIPPipe::HandleUpstreamWrite(const boost::system::error_code & ecode) { void TCPIPPipe::HandleUpstreamWrite(const boost::system::error_code & ecode)
if (ecode)
{ {
LogPrint(eLogError, "TCPIPPipe: Upstream write error:" , ecode.message());
if (ecode != boost::asio::error::operation_aborted) if (ecode != boost::asio::error::operation_aborted)
{
if (ecode)
{
LogPrint(eLogWarning, "TCPIPPipe: Upstream write error:" , ecode.message());
Terminate(); Terminate();
} }
else else
AsyncReceiveDownstream(); AsyncReceiveDownstream();
} }
}
void TCPIPPipe::HandleUpstreamReceived(const boost::system::error_code & ecode, std::size_t bytes_transfered) void TCPIPPipe::HandleUpstreamReceived(const boost::system::error_code & ecode, std::size_t bytes_transfered)
{
if (ecode != boost::asio::error::operation_aborted)
{ {
LogPrint(eLogDebug, "TCPIPPipe: Upstream ", (int)bytes_transfered, " bytes received"); LogPrint(eLogDebug, "TCPIPPipe: Upstream ", (int)bytes_transfered, " bytes received");
if (ecode) if (ecode)
{ {
LogPrint(eLogError, "TCPIPPipe: Upstream read error:" , ecode.message()); LogPrint(eLogWarning, "TCPIPPipe: Upstream read error:" , ecode.message());
if (ecode != boost::asio::error::operation_aborted)
Terminate(); Terminate();
} else { }
else
{
if (bytes_transfered > 0 ) if (bytes_transfered > 0 )
memcpy(m_downstream_buf, m_upstream_to_down_buf, bytes_transfered); memcpy(m_downstream_buf, m_upstream_to_down_buf, bytes_transfered);
DownstreamWrite(bytes_transfered); DownstreamWrite(bytes_transfered);
} }
} }
}
void TCPIPAcceptor::Start () void TCPIPAcceptor::Start ()
{ {

Loading…
Cancel
Save