0
0
mirror of https://github.com/monero-project/kovri synced 2025-10-06 00:32:51 +02:00

Kovri: fix log levels, log appropriate asio errors

This mostly affects transports. Keeps errors to *absolutely errors* and
not runtime issues that may be caused by an overloaded peer, for
example. An ultimate solution is to fine-tune error handling and fix
other known bugs.

Note: most of these warnings could, theoretically, be moved to debug
logging.
This commit is contained in:
anonimal
2018-07-25 01:09:32 +00:00
parent 6333929c0e
commit d2ad3bdcc7
10 changed files with 77 additions and 63 deletions

View File

@@ -101,8 +101,9 @@ void AddressBook::SubscriberUpdateTimer(
const boost::system::error_code& ecode) { const boost::system::error_code& ecode) {
LOG(debug) << "AddressBook: begin " << __func__; LOG(debug) << "AddressBook: begin " << __func__;
if (ecode) { if (ecode) {
LOG(error) if (ecode != boost::asio::error::operation_aborted)
<< "AddressBook: " << __func__ << " exception: " << ecode.message(); LOG(error) << "AddressBook: " << __func__ << ": '" << ecode.message()
<< "'";
return; return;
} }
// Load publishers (see below about multiple publishers) // Load publishers (see below about multiple publishers)
@@ -453,6 +454,7 @@ std::unique_ptr<const kovri::core::IdentHash> AddressBook::GetLoadedAddressIdent
return nullptr; return nullptr;
} }
// TODO(unassigned): return bool
void AddressBook::InsertAddress( void AddressBook::InsertAddress(
const std::string& host, const std::string& host,
const kovri::core::IdentHash& address, const kovri::core::IdentHash& address,
@@ -463,6 +465,7 @@ void AddressBook::InsertAddress(
// Ensure address book only inserts unique entries // Ensure address book only inserts unique entries
if (!m_Addresses.empty()) if (!m_Addresses.empty())
{ {
// TODO(unassigned): these throws should instead log warning and return bool
auto host_search = m_Addresses.find(host); auto host_search = m_Addresses.find(host);
if (host_search != m_Addresses.end()) if (host_search != m_Addresses.end())
throw std::runtime_error("AddressBook: host already loaded"); throw std::runtime_error("AddressBook: host already loaded");

View File

@@ -399,8 +399,8 @@ void ClientDestination::HandleDatabaseSearchReplyMessage(
} }
} }
if (!found) if (!found)
LOG(error) LOG(warning)
<< "ClientDestination: suggested floodfills are not presented in NetDb"; << "ClientDestination: suggested floodfills are not found in NetDb";
} else { } else {
LOG(debug) LOG(debug)
<< "ClientDestination: " << key.ToBase64() << " was not found on " << "ClientDestination: " << key.ToBase64() << " was not found on "
@@ -449,8 +449,10 @@ void ClientDestination::Publish() {
} }
auto outbound = m_Pool->GetNextOutboundTunnel(); auto outbound = m_Pool->GetNextOutboundTunnel();
if (!outbound) { if (!outbound) {
LOG(error) << "ClientDestination: can't publish LeaseSet, no outbound tunnels"; LOG(error)
return; << "ClientDestination: can't publish LeaseSet, no outbound tunnels "
"(router may need more time to integrate into the network)";
return;
} }
std::set<kovri::core::IdentHash> excluded; std::set<kovri::core::IdentHash> excluded;
auto floodfill = auto floodfill =

View File

@@ -134,9 +134,13 @@ void I2PTunnelConnection::HandleReceived(
const boost::system::error_code& ecode, const boost::system::error_code& ecode,
std::size_t bytes_transferred) { std::size_t bytes_transferred) {
if (ecode) { if (ecode) {
LOG(error) << "I2PTunnelConnection: read error: " << ecode.message();
if (ecode != boost::asio::error::operation_aborted) if (ecode != boost::asio::error::operation_aborted)
Terminate(); {
if (ecode != boost::asio::error::eof)
LOG(error) << "I2PTunnelConnection: " << __func__ << ": '"
<< ecode.message() << "'";
Terminate();
}
} else { } else {
if (m_Stream) { if (m_Stream) {
auto s = shared_from_this(); auto s = shared_from_this();
@@ -182,9 +186,12 @@ void I2PTunnelConnection::HandleStreamReceive(
const boost::system::error_code& ecode, const boost::system::error_code& ecode,
std::size_t bytes_transferred) { std::size_t bytes_transferred) {
if (ecode) { if (ecode) {
LOG(error) << "I2PTunnelConnection: stream read error: " << ecode.message();
if (ecode != boost::asio::error::operation_aborted) if (ecode != boost::asio::error::operation_aborted)
Terminate(); {
LOG(error) << "I2PTunnelConnection: " << __func__ << ": '"
<< ecode.message() << "'";
Terminate();
}
} else { } else {
Write(m_StreamBuffer, bytes_transferred); Write(m_StreamBuffer, bytes_transferred);
} }
@@ -341,7 +348,7 @@ void I2PClientTunnelHandler::HandleStreamRequestComplete(
connection->I2PConnect(); connection->I2PConnect();
Done(shared_from_this()); Done(shared_from_this());
} else { } else {
LOG(error) LOG(warning)
<< "I2PClientTunnelHandler: stream not available " << "I2PClientTunnelHandler: stream not available "
<< "(router may need more time to integrate into the network)"; << "(router may need more time to integrate into the network)";
Terminate(); Terminate();

View File

@@ -1,5 +1,5 @@
/** // /** //
* Copyright (c) 2013-2017, The Kovri I2P Router Project // * Copyright (c) 2013-2018, The Kovri I2P Router Project //
* // * //
* All rights reserved. // * All rights reserved. //
* // * //
@@ -162,9 +162,11 @@ void NetDbRequests::ManageRequests() {
} else { } else {
is_complete = true; is_complete = true;
if (!inbound) if (!inbound)
LOG(warning) << "NetDbRequests: no inbound tunnels"; LOG(warning) << "NetDbRequests: no inbound tunnels (router may "
"need more time to integrate into the network)";
if (!outbound) if (!outbound)
LOG(warning) << "NetDbRequests: no outbound tunnels"; LOG(warning) << "NetDbRequests: no outbound tunnels (router may "
"need more time to integrate into the network)";
if (!next_floodfill) if (!next_floodfill)
LOG(warning) << "NetDbRequests: no more floodfills"; LOG(warning) << "NetDbRequests: no more floodfills";
} }

View File

@@ -350,10 +350,8 @@ bool Transports::ConnectToPeer(
++peer.num_attempts; ++peer.num_attempts;
if (result) if (result)
return true; return true;
// Couldn't connect, get rid of this peer LOG(debug) << "Transports:" << GetFormattedSessionInfo(peer.router)
LOG(error) << __func__ << ": could not connect. Removing peer";
<< "Transports:" << GetFormattedSessionInfo(peer.router)
<< "no NTCP/SSU address available";
peer.Done(); peer.Done();
m_Peers.erase(ident); m_Peers.erase(ident);
return false; return false;

View File

@@ -1,5 +1,5 @@
/** // /** //
* Copyright (c) 2013-2017, The Kovri I2P Router Project // * Copyright (c) 2013-2018, The Kovri I2P Router Project //
* // * //
* All rights reserved. // * All rights reserved. //
* // * //
@@ -119,7 +119,9 @@ void NTCPServer::HandleAccept(
<< "NTCPServer: " << __func__ << " remote endpoint: " << ec.message(); << "NTCPServer: " << __func__ << " remote endpoint: " << ec.message();
} }
} else { } else {
LOG(error) << "NTCPServer: " << __func__ << ": '" << ecode.message() << "'"; if (ecode != boost::asio::error::operation_aborted)
LOG(error) << "NTCPServer: " << __func__ << ": '" << ecode.message()
<< "'";
} }
if (ecode != boost::asio::error::operation_aborted) { if (ecode != boost::asio::error::operation_aborted) {
conn = std::make_shared<NTCPSession>(*this); conn = std::make_shared<NTCPSession>(*this);
@@ -161,7 +163,9 @@ void NTCPServer::HandleAcceptV6(
<< "NTCPServer: " << __func__ << " remote endpoint: " << ec.message(); << "NTCPServer: " << __func__ << " remote endpoint: " << ec.message();
} }
} else { } else {
LOG(error) << "NTCPServer: " << __func__ << ": '" << ecode.message() << "'"; if (ecode != boost::asio::error::operation_aborted)
LOG(error) << "NTCPServer: " << __func__ << ": '" << ecode.message()
<< "'";
} }
if (ecode != boost::asio::error::operation_aborted) { if (ecode != boost::asio::error::operation_aborted) {
conn = std::make_shared<NTCPSession>(*this); conn = std::make_shared<NTCPSession>(*this);
@@ -198,7 +202,7 @@ void NTCPServer::HandleConnect(
std::shared_ptr<NTCPSession> conn, std::shared_ptr<NTCPSession> conn,
const boost::system::error_code& ecode) { const boost::system::error_code& ecode) {
if (ecode) { if (ecode) {
LOG(error) LOG(warning)
<< "NTCPServer:" << "NTCPServer:"
<< " [" << conn->GetRemoteRouter()->GetIdentHashAbbreviation() << "] " << " [" << conn->GetRemoteRouter()->GetIdentHashAbbreviation() << "] "
<< __func__ << ": '" << ecode.message() << "'"; << __func__ << ": '" << ecode.message() << "'";

View File

@@ -162,7 +162,7 @@ void NTCPSession::HandlePhase1Sent(
const boost::system::error_code& ecode, const boost::system::error_code& ecode,
std::size_t /*bytes_transferred*/) { std::size_t /*bytes_transferred*/) {
if (ecode) { if (ecode) {
LOG(error) LOG(warning)
<< "NTCPSession:" << GetFormattedSessionInfo() << "NTCPSession:" << GetFormattedSessionInfo()
<< "!!! couldn't send Phase1 '" << ecode.message() << "'"; << "!!! couldn't send Phase1 '" << ecode.message() << "'";
if (ecode != boost::asio::error::operation_aborted) if (ecode != boost::asio::error::operation_aborted)
@@ -191,13 +191,10 @@ void NTCPSession::HandlePhase2Received(
const boost::system::error_code& ecode, const boost::system::error_code& ecode,
std::size_t /*bytes_transferred*/) { std::size_t /*bytes_transferred*/) {
if (ecode) { if (ecode) {
LOG(error) LOG(warning)
<< "NTCPSession:" << GetFormattedSessionInfo() << "NTCPSession:" << GetFormattedSessionInfo()
<< "!!! Phase2 read error '" << ecode.message() << "'"; << "!!! " << __func__ << ": '" << ecode.message() << "'";
if (ecode != boost::asio::error::operation_aborted) { if (ecode != boost::asio::error::operation_aborted) {
LOG(error)
<< "NTCPSession:" << GetFormattedSessionInfo()
<< "!!! Phase2 error, RI is not valid";
LOG(trace) LOG(trace)
<< "NTCPSession:" << GetFormattedSessionInfo() << "NTCPSession:" << GetFormattedSessionInfo()
<< GetFormattedPhaseInfo(Phase::Two); << GetFormattedPhaseInfo(Phase::Two);
@@ -241,9 +238,9 @@ void NTCPSession::HandlePhase2Received(
m_Establisher->phase2.encrypted.hxy.data(), m_Establisher->phase2.encrypted.hxy.data(),
xy.data(), xy.data(),
NTCPSize::PubKey * 2)) { NTCPSize::PubKey * 2)) {
LOG(error) LOG(warning)
<< "NTCPSession:" << GetFormattedSessionInfo() << "NTCPSession:" << GetFormattedSessionInfo()
<< "!!! Phase2 << incorrect hash"; << "!!! " << __func__ << ": incorrect hash";
LOG(trace) LOG(trace)
<< "NTCPSession:" << GetFormattedSessionInfo() << "NTCPSession:" << GetFormattedSessionInfo()
<< "Decrypted " << GetFormattedPhaseInfo(Phase::Two); << "Decrypted " << GetFormattedPhaseInfo(Phase::Two);
@@ -375,7 +372,7 @@ void NTCPSession::HandlePhase3Sent(
std::size_t /*bytes_transferred*/, std::size_t /*bytes_transferred*/,
std::uint32_t ts_A) { std::uint32_t ts_A) {
if (ecode) { if (ecode) {
LOG(error) LOG(warning)
<< "NTCPSession:" << GetFormattedSessionInfo() << "NTCPSession:" << GetFormattedSessionInfo()
<< "!!! couldn't send Phase3 '" << ecode.message() << "'"; << "!!! couldn't send Phase3 '" << ecode.message() << "'";
if (ecode != boost::asio::error::operation_aborted) if (ecode != boost::asio::error::operation_aborted)
@@ -410,13 +407,10 @@ void NTCPSession::HandlePhase4Received(
std::size_t bytes_transferred, std::size_t bytes_transferred,
std::uint32_t ts_A) { std::uint32_t ts_A) {
if (ecode) { if (ecode) {
LOG(error) LOG(warning)
<< "NTCPSession:" << GetFormattedSessionInfo() << "NTCPSession:" << GetFormattedSessionInfo()
<< "!!! Phase4 read error '" << ecode.message() << "', check your clock"; // TODO(anonimal): error message << "!!! " << __func__ << ": '" << ecode.message() << "'";
if (ecode != boost::asio::error::operation_aborted) { if (ecode != boost::asio::error::operation_aborted) {
LOG(error)
<< "NTCPSession:" << GetFormattedSessionInfo()
<< "!!! Phase4, remote router does not like us";
kovri::core::netdb.SetUnreachable(GetRemoteIdentity().GetIdentHash(), true); kovri::core::netdb.SetUnreachable(GetRemoteIdentity().GetIdentHash(), true);
Terminate(); Terminate();
} }
@@ -441,7 +435,7 @@ void NTCPSession::HandlePhase4Received(
s.Insert(ts_A); // Timestamp Alice s.Insert(ts_A); // Timestamp Alice
s.Insert(m_Establisher->phase2.encrypted.timestamp); // Timestamp Bob s.Insert(m_Establisher->phase2.encrypted.timestamp); // Timestamp Bob
if (!s.Verify(m_RemoteIdentity, m_ReceiveBuffer)) { if (!s.Verify(m_RemoteIdentity, m_ReceiveBuffer)) {
LOG(error) LOG(warning)
<< "NTCPSession:" << GetFormattedSessionInfo() << "NTCPSession:" << GetFormattedSessionInfo()
<< "!!! Phase4 signature verification failed"; << "!!! Phase4 signature verification failed";
Terminate(); Terminate();
@@ -469,7 +463,7 @@ void NTCPSession::HandlePhase4Received(
void NTCPSession::ServerLogin() { void NTCPSession::ServerLogin() {
const auto& ecode = SetRemoteEndpoint(); const auto& ecode = SetRemoteEndpoint();
if (ecode) { if (ecode) {
LOG(error) LOG(warning)
<< "NTCPSession:" << GetFormattedSessionInfo() << "NTCPSession:" << GetFormattedSessionInfo()
<< "!!! " << __func__ << ": '" << ecode.message() << "'"; << "!!! " << __func__ << ": '" << ecode.message() << "'";
LOG(trace) LOG(trace)
@@ -497,9 +491,9 @@ void NTCPSession::HandlePhase1Received(
const boost::system::error_code& ecode, const boost::system::error_code& ecode,
std::size_t /*bytes_transferred*/) { std::size_t /*bytes_transferred*/) {
if (ecode) { if (ecode) {
LOG(error) LOG(warning)
<< "NTCPSession:" << GetFormattedSessionInfo() << "NTCPSession:" << GetFormattedSessionInfo()
<< "!!! Phase1 receive error '" << ecode.message() << "'"; << "!!! " << __func__ << ": '" << ecode.message() << "'";
if (ecode != boost::asio::error::operation_aborted) { if (ecode != boost::asio::error::operation_aborted) {
LOG(trace) LOG(trace)
<< "NTCPSession:" << GetFormattedSessionInfo() << "NTCPSession:" << GetFormattedSessionInfo()
@@ -653,9 +647,9 @@ void NTCPSession::HandlePhase3Received(
std::size_t bytes_transferred, std::size_t bytes_transferred,
std::uint32_t ts_B) { std::uint32_t ts_B) {
if (ecode) { if (ecode) {
LOG(error) LOG(warning)
<< "NTCPSession:" << GetFormattedSessionInfo() << "NTCPSession:" << GetFormattedSessionInfo()
<< "!!! Phase3 read error '" << ecode.message() << "'"; << "!!! " << __func__ << ": '" << ecode.message() << "'";
if (ecode != boost::asio::error::operation_aborted) if (ecode != boost::asio::error::operation_aborted)
Terminate(); Terminate();
return; return;
@@ -675,7 +669,7 @@ void NTCPSession::HandlePhase3Received(
std::uint16_t const size = core::InputByteStream::Read<std::uint16_t>(buf); std::uint16_t const size = core::InputByteStream::Read<std::uint16_t>(buf);
m_RemoteIdentity.FromBuffer(buf + NTCPSize::Phase3AliceRI, size); m_RemoteIdentity.FromBuffer(buf + NTCPSize::Phase3AliceRI, size);
if (m_Server.FindNTCPSession(m_RemoteIdentity.GetIdentHash())) { if (m_Server.FindNTCPSession(m_RemoteIdentity.GetIdentHash())) {
LOG(error) LOG(warning)
<< "NTCPSession:" << GetFormattedSessionInfo() << "NTCPSession:" << GetFormattedSessionInfo()
<< "!!! Phase3, session already exists"; << "!!! Phase3, session already exists";
Terminate(); Terminate();
@@ -717,9 +711,9 @@ void NTCPSession::HandlePhase3ExtraReceived(
std::uint32_t ts_B, std::uint32_t ts_B,
std::size_t padding_len) { std::size_t padding_len) {
if (ecode) { if (ecode) {
LOG(error) LOG(warning)
<< "NTCPSession:" << GetFormattedSessionInfo() << "NTCPSession:" << GetFormattedSessionInfo()
<< "!!! Phase3 << extra read error '" << ecode.message() << "'"; << "!!! " << __func__ << ": '" << ecode.message() << "'";
if (ecode != boost::asio::error::operation_aborted) if (ecode != boost::asio::error::operation_aborted)
Terminate(); Terminate();
return; return;
@@ -756,7 +750,7 @@ void NTCPSession::HandlePhase3(
s.Insert(ts_A); s.Insert(ts_A);
s.Insert(ts_B); s.Insert(ts_B);
if (!s.Verify(m_RemoteIdentity, buf)) { if (!s.Verify(m_RemoteIdentity, buf)) {
LOG(error) LOG(warning)
<< "NTCPSession:" << GetFormattedSessionInfo() << "NTCPSession:" << GetFormattedSessionInfo()
<< "!!! Phase3, signature verification failed"; << "!!! Phase3, signature verification failed";
Terminate(); Terminate();
@@ -895,7 +889,7 @@ void NTCPSession::HandleSentPayload(
m_NumSentBytes += bytes_transferred; m_NumSentBytes += bytes_transferred;
LOG(debug) LOG(debug)
<< "NTCPSession:" << GetFormattedSessionInfo() << "NTCPSession:" << GetFormattedSessionInfo()
<< "<-- " << bytes_transferred << " bytes transferred << " << "<-- " << bytes_transferred << " bytes transferred, "
<< GetNumSentBytes() << " total bytes sent"; << GetNumSentBytes() << " total bytes sent";
kovri::core::transports.UpdateSentBytes(bytes_transferred); kovri::core::transports.UpdateSentBytes(bytes_transferred);
if (!m_SendQueue.empty()) { if (!m_SendQueue.empty()) {
@@ -936,7 +930,7 @@ boost::asio::const_buffers_1 NTCPSession::CreateMsgBuffer(
if (msg) { if (msg) {
// Regular I2NP // Regular I2NP
if (msg->offset < NTCPSize::Phase3AliceRI) { if (msg->offset < NTCPSize::Phase3AliceRI) {
LOG(error) LOG(warning)
<< "NTCPSession:" << GetFormattedSessionInfo() << "NTCPSession:" << GetFormattedSessionInfo()
<< "!!! malformed I2NP message"; // TODO(unassigned): Error handling << "!!! malformed I2NP message"; // TODO(unassigned): Error handling
} }
@@ -1002,7 +996,7 @@ void NTCPSession::HandleReceivedPayload(
} }
// EOF errors are expected for short messages, so ignoring them here is fine // EOF errors are expected for short messages, so ignoring them here is fine
if (ecode && (ecode != boost::asio::error::eof)) { if (ecode && (ecode != boost::asio::error::eof)) {
LOG(error) LOG(warning)
<< "NTCPSession:" << GetFormattedSessionInfo() << "NTCPSession:" << GetFormattedSessionInfo()
<< "!!! " << __func__ << ": '" << ecode.message() << "'"; << "!!! " << __func__ << ": '" << ecode.message() << "'";
if (!m_NumReceivedBytes) { if (!m_NumReceivedBytes) {
@@ -1062,7 +1056,7 @@ bool NTCPSession::DecryptNextBlock(
if (data_size) { if (data_size) {
// New message // New message
if (data_size > NTCPSize::MaxMessage) { if (data_size > NTCPSize::MaxMessage) {
LOG(error) LOG(warning)
<< "NTCPSession:" << GetFormattedSessionInfo() << "NTCPSession:" << GetFormattedSessionInfo()
<< "!!! data block size '" << data_size << "' exceeds max size"; << "!!! data block size '" << data_size << "' exceeds max size";
return false; return false;
@@ -1159,10 +1153,10 @@ void NTCPSession::HandleTerminationTimer(
<< "NTCPSession:" << GetFormattedSessionInfo() << "NTCPSession:" << GetFormattedSessionInfo()
<< "*** handling termination timer"; << "*** handling termination timer";
if (ecode != boost::asio::error::operation_aborted) { if (ecode != boost::asio::error::operation_aborted) {
LOG(error) LOG(warning)
<< "NTCPSession:" << GetFormattedSessionInfo() << "NTCPSession:" << GetFormattedSessionInfo()
<< "!!! no activity for '" << "!!! no activity for "
<< GetType(NTCPTimeoutLength::Termination) << "' seconds"; << GetType(NTCPTimeoutLength::Termination) << " seconds";
// Terminate(); // Terminate();
m_Socket.close(); // invoke Terminate() from HandleReceive m_Socket.close(); // invoke Terminate() from HandleReceive
} }

View File

@@ -323,7 +323,7 @@ void SSUData::ProcessFragments(
m_ReceivedMessages.insert(msg_id); m_ReceivedMessages.insert(msg_id);
m_Handler.PutNextMessage(msg); m_Handler.PutNextMessage(msg);
} else { } else {
LOG(error) LOG(warning)
<< "SSUData:" << m_Session.GetFormattedSessionInfo() << "SSUData:" << m_Session.GetFormattedSessionInfo()
<< "SSU unexpected message " << "SSU unexpected message "
<< static_cast<int>(msg->GetTypeID()); << static_cast<int>(msg->GetTypeID());
@@ -543,7 +543,7 @@ void SSUData::HandleResendTimer(
+= it->second->num_resends * SSUDuration::ResendInterval; += it->second->num_resends * SSUDuration::ResendInterval;
it++; it++;
} else { } else {
LOG(error) LOG(warning)
<< "SSUData:" << m_Session.GetFormattedSessionInfo() << "SSUData:" << m_Session.GetFormattedSessionInfo()
<< "SSU message has not been ACKed after " << "SSU message has not been ACKed after "
<< static_cast<std::size_t>(SSUDuration::MaxResends) << " attempts. Deleted"; << static_cast<std::size_t>(SSUDuration::MaxResends) << " attempts. Deleted";
@@ -605,10 +605,10 @@ void SSUData::HandleIncompleteMessagesCleanupTimer(
std::uint8_t const timeout = SSUDuration::IncompleteMessagesCleanupTimeout; std::uint8_t const timeout = SSUDuration::IncompleteMessagesCleanupTimeout;
for (auto it = m_IncompleteMessages.begin(); it != m_IncompleteMessages.end();) { for (auto it = m_IncompleteMessages.begin(); it != m_IncompleteMessages.end();) {
if (ts > it->second->last_fragment_insert_time + timeout) { if (ts > it->second->last_fragment_insert_time + timeout) {
LOG(error) LOG(warning)
<< "SSUData:" << m_Session.GetFormattedSessionInfo() << "SSUData:" << m_Session.GetFormattedSessionInfo()
<< "SSU message " << it->first << " was not completed in " << "SSU message " << it->first << " was not completed in "
<< timeout << " seconds. Deleted"; << static_cast<std::uint16_t>(timeout) << " seconds. Deleted";
it = m_IncompleteMessages.erase(it); it = m_IncompleteMessages.erase(it);
} else { } else {
it++; it++;

View File

@@ -249,7 +249,9 @@ void SSUServer::HandleReceivedFrom(
} }
else else
{ {
LOG(error) << "SSUServer: receive error: " << ecode.message(); if (ecode != boost::asio::error::operation_aborted)
LOG(error) << "SSUServer: " << __func__ << ": '" << ecode.message()
<< "'";
#if (BOOST_VERSION < 106600) #if (BOOST_VERSION < 106600)
delete packet; // free packet, now delete packet; // free packet, now
#endif #endif
@@ -313,7 +315,9 @@ void SSUServer::HandleReceivedFromV6(
} }
else else
{ {
LOG(error) << "SSUServer: V6 receive error: " << ecode.message(); if (ecode != boost::asio::error::operation_aborted)
LOG(error) << "SSUServer: " << __func__ << ": '" << ecode.message()
<< "'";
#if (BOOST_VERSION < 106600) #if (BOOST_VERSION < 106600)
delete packet; // free packet, now delete packet; // free packet, now
#endif #endif
@@ -495,7 +499,7 @@ std::shared_ptr<SSUSession> SSUServer::GetSession(
} else { } else {
LOG(warning) LOG(warning)
<< "SSUServer: can't connect to unreachable router." << "SSUServer: can't connect to unreachable router."
<< "No introducers presented"; << "No introducers available";
std::unique_lock<std::mutex> l(m_SessionsMutex); std::unique_lock<std::mutex> l(m_SessionsMutex);
m_Sessions.erase(remote_endpoint); m_Sessions.erase(remote_endpoint);
session.reset(); session.reset();

View File

@@ -644,8 +644,8 @@ void SSUSession::ProcessSessionConfirmed(SSUPacket* pkt) {
if (m_SessionConfirmData.empty()) if (m_SessionConfirmData.empty())
{ {
// No session confirm data // No session confirm data
LOG(error) << "SSUSession:" << GetFormattedSessionInfo() LOG(warning) << "SSUSession:" << GetFormattedSessionInfo()
<< "unsolicited SessionConfirmed"; << "unsolicited SessionConfirmed";
return; // TODO(anonimal): throw/warn for potential attacks return; // TODO(anonimal): throw/warn for potential attacks
} }
@@ -1546,7 +1546,7 @@ void SSUSession::HandleConnectTimer(
const boost::system::error_code& ecode) { const boost::system::error_code& ecode) {
if (!ecode) { if (!ecode) {
// timeout expired // timeout expired
LOG(error) LOG(warning)
<< "SSUSession:" << GetFormattedSessionInfo() << "SSUSession:" << GetFormattedSessionInfo()
<< "session was not established after " << "session was not established after "
<< static_cast<std::size_t>(SSUDuration::ConnectTimeout) << " seconds"; << static_cast<std::size_t>(SSUDuration::ConnectTimeout) << " seconds";