@ -114,7 +114,7 @@ namespace tunnel
if ( ret . second )
if ( ret . second )
HandleOutOfSequenceFragment ( msgID , ret . first - > second ) ;
HandleOutOfSequenceFragment ( msgID , ret . first - > second ) ;
else
else
LogPrint ( eLogError , " Incomplete message " , msgID , " already exists " ) ;
LogPrint ( eLogError , " TunnelMessage: Incomplete message " , msgID , " already exists " ) ;
}
}
else
else
{
{
@ -123,7 +123,7 @@ namespace tunnel
}
}
}
}
else
else
LogPrint ( eLogError , " Message is fragmented, but msgID is not presented " ) ;
LogPrint ( eLogError , " TunnelMessage: Message is fragmented, but msgID is not presented" ) ;
}
}
fragment + = size ;
fragment + = size ;
@ -147,13 +147,13 @@ namespace tunnel
{
{
if ( msg . data - > len + size > msg . data - > maxLen )
if ( msg . data - > len + size > msg . data - > maxLen )
{
{
LogPrint ( eLogInfo , " Tunnel endpoint I2NP message size " , msg . data - > maxLen , " is not enough " ) ;
LogPrint ( eLogWarning , " TunnelMessage: I2NP message size " , msg . data - > maxLen , " is not enough " ) ;
auto newMsg = NewI2NPMessage ( ) ;
auto newMsg = NewI2NPMessage ( ) ;
* newMsg = * ( msg . data ) ;
* newMsg = * ( msg . data ) ;
msg . data = newMsg ;
msg . data = newMsg ;
}
}
if ( msg . data - > Concat ( fragment , size ) < size ) // concatenate fragment
if ( msg . data - > Concat ( fragment , size ) < size ) // concatenate fragment
LogPrint ( eLogError , " Tunnel endpoint I2NP buffer overflow " , msg . data - > maxLen ) ;
LogPrint ( eLogError , " TunnelMessage: I2NP buffer overflow " , msg . data - > maxLen ) ;
if ( isLastFragment )
if ( isLastFragment )
{
{
// message complete
// message complete
@ -168,19 +168,19 @@ namespace tunnel
}
}
else
else
{
{
LogPrint ( eLogError , " Fragment " , m . nextFragmentNum , " of message " , msgID , " exceeds max I2NP message size. M essage dropped " ) ;
LogPrint ( eLogError , " TunnelMessage: Fragment " , m . nextFragmentNum , " of message " , msgID , " exceeds max I2NP message size, m essage dropped " ) ;
m_IncompleteMessages . erase ( it ) ;
m_IncompleteMessages . erase ( it ) ;
}
}
}
}
else
else
{
{
LogPrint ( eLogInfo , " Unexpected fragment " , ( int ) m . nextFragmentNum , " instead " , ( int ) msg . nextFragmentNum , " of message " , msgID , " . S aved" ) ;
LogPrint ( eLogWarning , " TunnelMessage: Unexpected fragment " , ( int ) m . nextFragmentNum , " instead " , ( int ) msg . nextFragmentNum , " of message " , msgID , " , s aved" ) ;
AddOutOfSequenceFragment ( msgID , m . nextFragmentNum , isLastFragment , m . data ) ;
AddOutOfSequenceFragment ( msgID , m . nextFragmentNum , isLastFragment , m . data ) ;
}
}
}
}
else
else
{
{
LogPrint ( eLogInfo , " First fragment of message " , msgID , " not found. S aved " ) ;
LogPrint ( eLogWarning , " TunnelMessage: First fragment of message " , msgID , " not found, s aved " ) ;
AddOutOfSequenceFragment ( msgID , m . nextFragmentNum , isLastFragment , m . data ) ;
AddOutOfSequenceFragment ( msgID , m . nextFragmentNum , isLastFragment , m . data ) ;
}
}
}
}
@ -199,11 +199,11 @@ namespace tunnel
{
{
if ( it - > second . fragmentNum = = msg . nextFragmentNum )
if ( it - > second . fragmentNum = = msg . nextFragmentNum )
{
{
LogPrint ( eLogInfo , " Out-of-sequence fragment " , ( int ) it - > second . fragmentNum , " of message " , msgID , " found " ) ;
LogPrint ( eLogWarning , " TunnelMessage: Out-of-sequence fragment " , ( int ) it - > second . fragmentNum , " of message " , msgID , " found " ) ;
auto size = it - > second . data - > GetLength ( ) ;
auto size = it - > second . data - > GetLength ( ) ;
if ( msg . data - > len + size > msg . data - > maxLen )
if ( msg . data - > len + size > msg . data - > maxLen )
{
{
LogPrint ( eLogInfo , " Tunnel endpoint I2NP message size " , msg . data - > maxLen , " is not enough " ) ;
LogPrint ( eLogWarning , " TunnelMessage: Tunnel endpoint I2NP message size " , msg . data - > maxLen , " is not enough " ) ;
auto newMsg = NewI2NPMessage ( ) ;
auto newMsg = NewI2NPMessage ( ) ;
* newMsg = * ( msg . data ) ;
* newMsg = * ( msg . data ) ;
msg . data = newMsg ;
msg . data = newMsg ;
@ -241,13 +241,13 @@ namespace tunnel
if ( ! m_IsInbound ) // outbound transit tunnel
if ( ! m_IsInbound ) // outbound transit tunnel
i2p : : transport : : transports . SendMessage ( msg . hash , i2p : : CreateTunnelGatewayMsg ( msg . tunnelID , msg . data ) ) ;
i2p : : transport : : transports . SendMessage ( msg . hash , i2p : : CreateTunnelGatewayMsg ( msg . tunnelID , msg . data ) ) ;
else
else
LogPrint ( eLogError , " Delivery type tunnel arrived from an inbound tunnel. D ropped" ) ;
LogPrint ( eLogError , " TunnelMessage: Delivery type 'tunnel' arrived from an inbound tunnel, d ropped" ) ;
break ;
break ;
case eDeliveryTypeRouter :
case eDeliveryTypeRouter :
if ( ! m_IsInbound ) // outbound transit tunnel
if ( ! m_IsInbound ) // outbound transit tunnel
i2p : : transport : : transports . SendMessage ( msg . hash , msg . data ) ;
i2p : : transport : : transports . SendMessage ( msg . hash , msg . data ) ;
else // we shouldn't send this message. possible leakage
else // we shouldn't send this message. possible leakage
LogPrint ( eLogError , " Delivery type router arrived from an inbound tunnel. D ropped" ) ;
LogPrint ( eLogError , " TunnelMessage: Delivery type 'router' arrived from an inbound tunnel, d ropped" ) ;
break ;
break ;
default :
default :
LogPrint ( eLogError , " TunnelMessage: Unknown delivery type " , ( int ) msg . deliveryType ) ;
LogPrint ( eLogError , " TunnelMessage: Unknown delivery type " , ( int ) msg . deliveryType ) ;