Browse Source

reduced numeber of error messages

pull/352/head
orignal 9 years ago
parent
commit
c053bebccd
  1. 22
      NTCPSession.cpp
  2. 2
      NTCPSession.h
  3. 6
      SSUData.cpp
  4. 18
      SSUSession.cpp
  5. 2
      Transports.cpp
  6. 4
      Tunnel.cpp

22
NTCPSession.cpp

@ -136,7 +136,7 @@ namespace transport
{ {
if (ecode) if (ecode)
{ {
LogPrint (eLogError, "NTCP: couldn't send Phase 1 message: ", ecode.message ()); LogPrint (eLogInfo, "NTCP: couldn't send Phase 1 message: ", ecode.message ());
if (ecode != boost::asio::error::operation_aborted) if (ecode != boost::asio::error::operation_aborted)
Terminate (); Terminate ();
} }
@ -152,7 +152,7 @@ namespace transport
{ {
if (ecode) if (ecode)
{ {
LogPrint (eLogError, "NTCP: phase 1 read error: ", ecode.message ()); LogPrint (eLogInfo, "NTCP: phase 1 read error: ", ecode.message ());
if (ecode != boost::asio::error::operation_aborted) if (ecode != boost::asio::error::operation_aborted)
Terminate (); Terminate ();
} }
@ -207,7 +207,7 @@ namespace transport
{ {
if (ecode) if (ecode)
{ {
LogPrint (eLogError, "NTCP: Couldn't send Phase 2 message: ", ecode.message ()); LogPrint (eLogInfo, "NTCP: Couldn't send Phase 2 message: ", ecode.message ());
if (ecode != boost::asio::error::operation_aborted) if (ecode != boost::asio::error::operation_aborted)
Terminate (); Terminate ();
} }
@ -223,7 +223,7 @@ namespace transport
{ {
if (ecode) if (ecode)
{ {
LogPrint (eLogError, "NTCP: Phase 2 read error: ", ecode.message (), ". Wrong ident assumed"); LogPrint (eLogInfo, "NTCP: Phase 2 read error: ", ecode.message (), ". Wrong ident assumed");
if (ecode != boost::asio::error::operation_aborted) if (ecode != boost::asio::error::operation_aborted)
{ {
// this RI is not valid // this RI is not valid
@ -299,7 +299,7 @@ namespace transport
{ {
if (ecode) if (ecode)
{ {
LogPrint (eLogError, "NTCP: Couldn't send Phase 3 message: ", ecode.message ()); LogPrint (eLogInfo, "NTCP: Couldn't send Phase 3 message: ", ecode.message ());
if (ecode != boost::asio::error::operation_aborted) if (ecode != boost::asio::error::operation_aborted)
Terminate (); Terminate ();
} }
@ -319,7 +319,7 @@ namespace transport
{ {
if (ecode) if (ecode)
{ {
LogPrint (eLogError, "NTCP: Phase 3 read error: ", ecode.message ()); LogPrint (eLogInfo, "NTCP: Phase 3 read error: ", ecode.message ());
if (ecode != boost::asio::error::operation_aborted) if (ecode != boost::asio::error::operation_aborted)
Terminate (); Terminate ();
} }
@ -331,7 +331,7 @@ namespace transport
SetRemoteIdentity (std::make_shared<i2p::data::IdentityEx> (buf + 2, size)); SetRemoteIdentity (std::make_shared<i2p::data::IdentityEx> (buf + 2, size));
if (m_Server.FindNTCPSession (m_RemoteIdentity->GetIdentHash ())) if (m_Server.FindNTCPSession (m_RemoteIdentity->GetIdentHash ()))
{ {
LogPrint (eLogError, "NTCP: session already exists"); LogPrint (eLogInfo, "NTCP: session already exists");
Terminate (); Terminate ();
} }
size_t expectedSize = size + 2/*size*/ + 4/*timestamp*/ + m_RemoteIdentity->GetSignatureLen (); size_t expectedSize = size + 2/*size*/ + 4/*timestamp*/ + m_RemoteIdentity->GetSignatureLen ();
@ -354,7 +354,7 @@ namespace transport
{ {
if (ecode) if (ecode)
{ {
LogPrint (eLogError, "NTCP: Phase 3 extra read error: ", ecode.message ()); LogPrint (eLogInfo, "NTCP: Phase 3 extra read error: ", ecode.message ());
if (ecode != boost::asio::error::operation_aborted) if (ecode != boost::asio::error::operation_aborted)
Terminate (); Terminate ();
} }
@ -498,7 +498,7 @@ namespace transport
{ {
if (ecode) if (ecode)
{ {
LogPrint (eLogError, "NTCP: Read error: ", ecode.message ()); LogPrint (eLogInfo, "NTCP: Read error: ", ecode.message ());
if (!m_NumReceivedBytes) m_Server.Ban (m_ConnectedFrom); if (!m_NumReceivedBytes) m_Server.Ban (m_ConnectedFrom);
//if (ecode != boost::asio::error::operation_aborted) //if (ecode != boost::asio::error::operation_aborted)
Terminate (); Terminate ();
@ -540,7 +540,7 @@ namespace transport
moreBytes = m_Socket.read_some (boost::asio::buffer (m_ReceiveBuffer + m_ReceiveBufferOffset, moreBytes)); moreBytes = m_Socket.read_some (boost::asio::buffer (m_ReceiveBuffer + m_ReceiveBufferOffset, moreBytes));
if (ec) if (ec)
{ {
LogPrint (eLogError, "NTCP: Read more bytes error: ", ec.message ()); LogPrint (eLogInfo, "NTCP: Read more bytes error: ", ec.message ());
Terminate (); Terminate ();
return; return;
} }
@ -732,7 +732,7 @@ namespace transport
} }
//----------------------------------------- //-----------------------------------------
NTCPServer::NTCPServer (int port): NTCPServer::NTCPServer ():
m_IsRunning (false), m_Thread (nullptr), m_Work (m_Service), m_IsRunning (false), m_Thread (nullptr), m_Work (m_Service),
m_NTCPAcceptor (nullptr), m_NTCPV6Acceptor (nullptr) m_NTCPAcceptor (nullptr), m_NTCPV6Acceptor (nullptr)
{ {

2
NTCPSession.h

@ -134,7 +134,7 @@ namespace transport
{ {
public: public:
NTCPServer (int port); NTCPServer ();
~NTCPServer (); ~NTCPServer ();
void Start (); void Start ();

6
SSUData.cpp

@ -352,7 +352,7 @@ namespace transport
} }
catch (boost::system::system_error& ec) catch (boost::system::system_error& ec)
{ {
LogPrint (eLogError, "SSU: Can't send data fragment ", ec.what ()); LogPrint (eLogWarning, "SSU: Can't send data fragment ", ec.what ());
} }
if (!isLast) if (!isLast)
{ {
@ -440,7 +440,7 @@ namespace transport
} }
catch (boost::system::system_error& ec) catch (boost::system::system_error& ec)
{ {
LogPrint (eLogError, "SSU: Can't resend data fragment ", ec.what ()); LogPrint (eLogWarning, "SSU: Can't resend data fragment ", ec.what ());
} }
} }
@ -450,7 +450,7 @@ namespace transport
} }
else else
{ {
LogPrint (eLogError, "SSU: message has not been ACKed after ", MAX_NUM_RESENDS, " attempts, deleted"); LogPrint (eLogInfo, "SSU: message has not been ACKed after ", MAX_NUM_RESENDS, " attempts, deleted");
it = m_SentMessages.erase (it); it = m_SentMessages.erase (it);
} }
} }

18
SSUSession.cpp

@ -113,14 +113,14 @@ namespace transport
auto address = i2p::context.GetRouterInfo ().GetSSUAddress (); auto address = i2p::context.GetRouterInfo ().GetSSUAddress ();
if (!address) if (!address)
{ {
LogPrint (eLogError, "SSU is not supported"); LogPrint (eLogInfo, "SSU is not supported");
return; return;
} }
if (Validate (buf, len, address->key)) if (Validate (buf, len, address->key))
Decrypt (buf, len, address->key); Decrypt (buf, len, address->key);
else else
{ {
LogPrint (eLogError, "SSU: MAC verification failed ", len, " bytes from ", senderEndpoint); LogPrint (eLogWarning, "SSU: MAC verification failed ", len, " bytes from ", senderEndpoint);
m_Server.DeleteSession (shared_from_this ()); m_Server.DeleteSession (shared_from_this ());
return; return;
} }
@ -330,7 +330,7 @@ namespace transport
auto address = i2p::context.GetRouterInfo ().GetSSUAddress (); auto address = i2p::context.GetRouterInfo ().GetSSUAddress ();
if (!address) if (!address)
{ {
LogPrint (eLogError, "SSU is not supported"); LogPrint (eLogInfo, "SSU is not supported");
return; return;
} }
@ -363,7 +363,7 @@ namespace transport
i2p::context.GetRouterInfo ().GetSSUAddress (true); //v4 only i2p::context.GetRouterInfo ().GetSSUAddress (true); //v4 only
if (!address) if (!address)
{ {
LogPrint (eLogError, "SSU is not supported"); LogPrint (eLogInfo, "SSU is not supported");
return; return;
} }
SignedData s; // x,y, remote IP, remote port, our IP, our port, relayTag, signed on time SignedData s; // x,y, remote IP, remote port, our IP, our port, relayTag, signed on time
@ -508,7 +508,7 @@ namespace transport
// Charlie's address always v4 // Charlie's address always v4
if (!to.address ().is_v4 ()) if (!to.address ().is_v4 ())
{ {
LogPrint (eLogError, "SSU: Charlie's IP must be v4"); LogPrint (eLogWarning, "SSU: Charlie's IP must be v4");
return; return;
} }
*payload = 4; *payload = 4;
@ -560,7 +560,7 @@ namespace transport
// Alice's address always v4 // Alice's address always v4
if (!from.address ().is_v4 ()) if (!from.address ().is_v4 ())
{ {
LogPrint (eLogError, "SSU: Alice's IP must be v4"); LogPrint (eLogWarning, "SSU: Alice's IP must be v4");
return; return;
} }
uint8_t buf[48 + 18]; uint8_t buf[48 + 18];
@ -1015,7 +1015,7 @@ namespace transport
if (addr) if (addr)
memcpy (payload, addr->key, 32); // intro key memcpy (payload, addr->key, 32); // intro key
else else
LogPrint (eLogError, "SSU is not supported. Can't send peer test"); LogPrint (eLogInfo, "SSU is not supported. Can't send peer test");
} }
else else
memcpy (payload, introKey, 32); // intro key memcpy (payload, introKey, 32); // intro key
@ -1044,7 +1044,7 @@ namespace transport
auto address = i2p::context.GetRouterInfo ().GetSSUAddress (); auto address = i2p::context.GetRouterInfo ().GetSSUAddress ();
if (!address) if (!address)
{ {
LogPrint (eLogError, "SSU is not supported. Can't send peer test"); LogPrint (eLogInfo, "SSU is not supported. Can't send peer test");
return; return;
} }
uint32_t nonce; uint32_t nonce;
@ -1085,7 +1085,7 @@ namespace transport
} }
catch (std::exception& ex) catch (std::exception& ex)
{ {
LogPrint (eLogError, "SSU: exception while send session destoriyed: ", ex.what ()); LogPrint (eLogWarning, "SSU: exception while sending session destoroyed: ", ex.what ());
} }
LogPrint (eLogDebug, "SSU: session destroyed sent"); LogPrint (eLogDebug, "SSU: session destroyed sent");
} }

2
Transports.cpp

@ -117,7 +117,7 @@ namespace transport
{ {
if (!m_NTCPServer) if (!m_NTCPServer)
{ {
m_NTCPServer = new NTCPServer (address.port); m_NTCPServer = new NTCPServer ();
m_NTCPServer->Start (); m_NTCPServer->Start ();
} }

4
Tunnel.cpp

@ -442,7 +442,7 @@ namespace tunnel
HandleI2NPMessage (msg->GetBuffer (), msg->GetLength ()); HandleI2NPMessage (msg->GetBuffer (), msg->GetLength ());
break; break;
default: default:
LogPrint (eLogError, "Tunnel: unexpected messsage type ", (int) typeID); LogPrint (eLogWarning, "Tunnel: unexpected messsage type ", (int) typeID);
} }
msg = m_Queue.Get (); msg = m_Queue.Get ();
@ -551,7 +551,7 @@ namespace tunnel
it++; it++;
break; break;
case eTunnelStateBuildFailed: case eTunnelStateBuildFailed:
LogPrint (eLogError, "Tunnel: pending build request ", it->first, " failed, deleted"); LogPrint (eLogWarning, "Tunnel: pending build request ", it->first, " failed, deleted");
it = pendingTunnels.erase (it); it = pendingTunnels.erase (it);
m_NumFailedTunnelCreations++; m_NumFailedTunnelCreations++;
break; break;

Loading…
Cancel
Save