|
|
@ -109,17 +109,27 @@ namespace tunnel |
|
|
|
for (auto it: m_Tests) |
|
|
|
for (auto it: m_Tests) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint ("Tunnel test ", (int)it.first, " failed"); |
|
|
|
LogPrint ("Tunnel test ", (int)it.first, " failed"); |
|
|
|
// both outbound and inbound tunnels considered as invalid
|
|
|
|
// if test failed again with another tunnel we consider it failed
|
|
|
|
if (it.second.first) |
|
|
|
if (it.second.first) |
|
|
|
{ |
|
|
|
{ |
|
|
|
it.second.first->SetFailed (true); |
|
|
|
if (it.second.first->GetState () == eTunnelStateTestFailed) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
it.second.first->SetState (eTunnelStateFailed); |
|
|
|
m_OutboundTunnels.erase (it.second.first); |
|
|
|
m_OutboundTunnels.erase (it.second.first); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
it.second.first->SetState (eTunnelStateTestFailed); |
|
|
|
|
|
|
|
} |
|
|
|
if (it.second.second) |
|
|
|
if (it.second.second) |
|
|
|
{ |
|
|
|
{ |
|
|
|
it.second.second->SetFailed (true); |
|
|
|
if (it.second.second->GetState () == eTunnelStateTestFailed) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
it.second.second->SetState (eTunnelStateFailed); |
|
|
|
m_InboundTunnels.erase (it.second.second); |
|
|
|
m_InboundTunnels.erase (it.second.second); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
it.second.second->SetState (eTunnelStateTestFailed); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
m_Tests.clear (); |
|
|
|
m_Tests.clear (); |
|
|
|
auto it1 = m_OutboundTunnels.begin (); |
|
|
|
auto it1 = m_OutboundTunnels.begin (); |
|
|
@ -156,6 +166,9 @@ namespace tunnel |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint ("Tunnel test ", it->first, " successive. ", i2p::util::GetMillisecondsSinceEpoch () - be64toh (deliveryStatus->timestamp), " milliseconds"); |
|
|
|
LogPrint ("Tunnel test ", it->first, " successive. ", i2p::util::GetMillisecondsSinceEpoch () - be64toh (deliveryStatus->timestamp), " milliseconds"); |
|
|
|
m_Tests.erase (it); |
|
|
|
m_Tests.erase (it); |
|
|
|
|
|
|
|
// restore from test failed state if any
|
|
|
|
|
|
|
|
it->second.first->SetState (eTunnelStateEstablished); |
|
|
|
|
|
|
|
it->second.second->SetState (eTunnelStateEstablished); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
i2p::garlic::routing.HandleDeliveryStatusMessage (msg->GetPayload (), msg->GetLength ()); // TODO:
|
|
|
|
i2p::garlic::routing.HandleDeliveryStatusMessage (msg->GetPayload (), msg->GetLength ()); // TODO:
|
|
|
|