Browse Source

inalidate shared routing path

pull/690/head
orignal 8 years ago
parent
commit
1286f1c968
  1. 14
      Destination.cpp
  2. 10
      Streaming.cpp

14
Destination.cpp

@ -280,7 +280,7 @@ namespace client
std::shared_ptr<i2p::data::LeaseSet> leaseSet; std::shared_ptr<i2p::data::LeaseSet> leaseSet;
if (buf[DATABASE_STORE_TYPE_OFFSET] == 1) // LeaseSet if (buf[DATABASE_STORE_TYPE_OFFSET] == 1) // LeaseSet
{ {
LogPrint (eLogDebug, "Remote LeaseSet"); LogPrint (eLogDebug, "Destination: Remote LeaseSet");
std::lock_guard<std::mutex> lock(m_RemoteLeaseSetsMutex); std::lock_guard<std::mutex> lock(m_RemoteLeaseSetsMutex);
auto it = m_RemoteLeaseSets.find (buf + DATABASE_STORE_KEY_OFFSET); auto it = m_RemoteLeaseSets.find (buf + DATABASE_STORE_KEY_OFFSET);
if (it != m_RemoteLeaseSets.end ()) if (it != m_RemoteLeaseSets.end ())
@ -290,16 +290,16 @@ namespace client
{ {
leaseSet->Update (buf + offset, len - offset); leaseSet->Update (buf + offset, len - offset);
if (leaseSet->IsValid ()) if (leaseSet->IsValid ())
LogPrint (eLogDebug, "Remote LeaseSet updated"); LogPrint (eLogDebug, "Destination: Remote LeaseSet updated");
else else
{ {
LogPrint (eLogDebug, "Remote LeaseSet update failed"); LogPrint (eLogDebug, "Destination: Remote LeaseSet update failed");
m_RemoteLeaseSets.erase (it); m_RemoteLeaseSets.erase (it);
leaseSet = nullptr; leaseSet = nullptr;
} }
} }
else else
LogPrint (eLogDebug, "Remote LeaseSet is older. Not updated"); LogPrint (eLogDebug, "Destination: Remote LeaseSet is older. Not updated");
} }
else else
{ {
@ -308,15 +308,15 @@ namespace client
{ {
if (leaseSet->GetIdentHash () != GetIdentHash ()) if (leaseSet->GetIdentHash () != GetIdentHash ())
{ {
LogPrint (eLogDebug, "New remote LeaseSet added"); LogPrint (eLogDebug, "Destination: New remote LeaseSet added");
m_RemoteLeaseSets[buf + DATABASE_STORE_KEY_OFFSET] = leaseSet; m_RemoteLeaseSets[buf + DATABASE_STORE_KEY_OFFSET] = leaseSet;
} }
else else
LogPrint (eLogDebug, "Own remote LeaseSet dropped"); LogPrint (eLogDebug, "Destination: Own remote LeaseSet dropped");
} }
else else
{ {
LogPrint (eLogError, "New remote LeaseSet failed"); LogPrint (eLogError, "Destination: New remote LeaseSet failed");
leaseSet = nullptr; leaseSet = nullptr;
} }
} }

10
Streaming.cpp

@ -656,7 +656,11 @@ namespace stream
m_CurrentOutboundTunnel->SendTunnelDataMsg (msgs); m_CurrentOutboundTunnel->SendTunnelDataMsg (msgs);
} }
else else
LogPrint (eLogWarning, "Streaming: All leases are expired, sSID=", m_SendStreamID); {
LogPrint (eLogWarning, "Streaming: Remote lease is not available, sSID=", m_SendStreamID);
if (m_RoutingSession)
m_RoutingSession->SetSharedRoutingPath (nullptr); // invalidate routing path
}
} }
void Stream::SendUpdatedLeaseSet () void Stream::SendUpdatedLeaseSet ()
@ -824,13 +828,17 @@ namespace stream
} }
else else
{ {
LogPrint (eLogWarning, "Streaming: All remote leases are expired");
m_RemoteLeaseSet = nullptr; m_RemoteLeaseSet = nullptr;
m_CurrentRemoteLease = nullptr; m_CurrentRemoteLease = nullptr;
// we have requested expired before, no need to do it twice // we have requested expired before, no need to do it twice
} }
} }
else else
{
LogPrint (eLogWarning, "Streaming: Remote LeaseSet not found");
m_CurrentRemoteLease = nullptr; m_CurrentRemoteLease = nullptr;
}
} }
StreamingDestination::StreamingDestination (std::shared_ptr<i2p::client::ClientDestination> owner, uint16_t localPort, bool gzip): StreamingDestination::StreamingDestination (std::shared_ptr<i2p::client::ClientDestination> owner, uint16_t localPort, bool gzip):

Loading…
Cancel
Save