Browse Source

* sane log messages: BOB.cpp

pull/317/head
hagen 9 years ago
parent
commit
a0fe02a560
  1. 26
      BOB.cpp

26
BOB.cpp

@ -61,7 +61,7 @@ namespace client
std::shared_ptr<AddressReceiver> receiver) std::shared_ptr<AddressReceiver> receiver)
{ {
if (ecode) if (ecode)
LogPrint ("BOB inbound tunnel read error: ", ecode.message ()); LogPrint (eLogError, "BOB: inbound tunnel read error: ", ecode.message ());
else else
{ {
receiver->bufferOffset += bytes_transferred; receiver->bufferOffset += bytes_transferred;
@ -76,7 +76,7 @@ namespace client
i2p::data::IdentHash ident; i2p::data::IdentHash ident;
if (!context.GetAddressBook ().GetIdentHash (receiver->buffer, ident)) if (!context.GetAddressBook ().GetIdentHash (receiver->buffer, ident))
{ {
LogPrint (eLogError, "BOB address ", receiver->buffer, " not found"); LogPrint (eLogError, "BOB: address ", receiver->buffer, " not found");
return; return;
} }
auto leaseSet = GetLocalDestination ()->FindLeaseSet (ident); auto leaseSet = GetLocalDestination ()->FindLeaseSet (ident);
@ -92,7 +92,7 @@ namespace client
if (receiver->bufferOffset < BOB_COMMAND_BUFFER_SIZE) if (receiver->bufferOffset < BOB_COMMAND_BUFFER_SIZE)
ReceiveAddress (receiver); ReceiveAddress (receiver);
else else
LogPrint ("BOB missing inbound address "); LogPrint (eLogError, "BOB: missing inbound address");
} }
} }
} }
@ -102,12 +102,12 @@ namespace client
if (leaseSet) if (leaseSet)
CreateConnection (receiver, leaseSet); CreateConnection (receiver, leaseSet);
else else
LogPrint ("LeaseSet for BOB inbound destination not found"); LogPrint (eLogError, "BOB: LeaseSet for inbound destination not found");
} }
void BOBI2PInboundTunnel::CreateConnection (std::shared_ptr<AddressReceiver> receiver, std::shared_ptr<const i2p::data::LeaseSet> leaseSet) void BOBI2PInboundTunnel::CreateConnection (std::shared_ptr<AddressReceiver> receiver, std::shared_ptr<const i2p::data::LeaseSet> leaseSet)
{ {
LogPrint ("New BOB inbound connection"); LogPrint (eLogDebug, "BOB: New inbound connection");
auto connection = std::make_shared<I2PTunnelConnection>(this, receiver->socket, leaseSet); auto connection = std::make_shared<I2PTunnelConnection>(this, receiver->socket, leaseSet);
AddHandler (connection); AddHandler (connection);
connection->I2PConnect (receiver->data, receiver->dataLen); connection->I2PConnect (receiver->data, receiver->dataLen);
@ -135,7 +135,7 @@ namespace client
if (localDestination) if (localDestination)
localDestination->AcceptStreams (std::bind (&BOBI2POutboundTunnel::HandleAccept, this, std::placeholders::_1)); localDestination->AcceptStreams (std::bind (&BOBI2POutboundTunnel::HandleAccept, this, std::placeholders::_1));
else else
LogPrint ("Local destination not set for server tunnel"); LogPrint (eLogError, "BOB: Local destination not set for server tunnel");
} }
void BOBI2POutboundTunnel::HandleAccept (std::shared_ptr<i2p::stream::Stream> stream) void BOBI2POutboundTunnel::HandleAccept (std::shared_ptr<i2p::stream::Stream> stream)
@ -229,7 +229,7 @@ namespace client
{ {
if (ecode) if (ecode)
{ {
LogPrint ("BOB command channel read error: ", ecode.message ()); LogPrint (eLogError, "BOB: command channel read error: ", ecode.message ());
if (ecode != boost::asio::error::operation_aborted) if (ecode != boost::asio::error::operation_aborted)
Terminate (); Terminate ();
} }
@ -256,7 +256,7 @@ namespace client
(this->*(it->second))(operand, eol - operand); (this->*(it->second))(operand, eol - operand);
else else
{ {
LogPrint (eLogError, "BOB unknown command ", m_ReceiveBuffer); LogPrint (eLogError, "BOB: unknown command ", m_ReceiveBuffer);
SendReplyError ("unknown command"); SendReplyError ("unknown command");
} }
@ -269,7 +269,7 @@ namespace client
m_ReceiveBufferOffset = size; m_ReceiveBufferOffset = size;
else else
{ {
LogPrint (eLogError, "Malformed input of the BOB command channel"); LogPrint (eLogError, "BOB: Malformed input of the command channel");
Terminate (); Terminate ();
} }
} }
@ -288,7 +288,7 @@ namespace client
{ {
if (ecode) if (ecode)
{ {
LogPrint ("BOB command channel send error: ", ecode.message ()); LogPrint (eLogError, "BOB: command channel send error: ", ecode.message ());
if (ecode != boost::asio::error::operation_aborted) if (ecode != boost::asio::error::operation_aborted)
Terminate (); Terminate ();
} }
@ -589,7 +589,7 @@ namespace client
} }
catch (std::exception& ex) catch (std::exception& ex)
{ {
LogPrint (eLogError, "BOB: ", ex.what ()); LogPrint (eLogError, "BOB: runtime exception: ", ex.what ());
} }
} }
} }
@ -632,11 +632,11 @@ namespace client
if (!ecode) if (!ecode)
{ {
LogPrint (eLogInfo, "New BOB command connection from ", session->GetSocket ().remote_endpoint ()); LogPrint (eLogInfo, "BOB: New command connection from ", session->GetSocket ().remote_endpoint ());
session->SendVersion (); session->SendVersion ();
} }
else else
LogPrint (eLogError, "BOB accept error: ", ecode.message ()); LogPrint (eLogError, "BOB: accept error: ", ecode.message ());
} }
} }
} }

Loading…
Cancel
Save