send own LeasetSet through a stalled stream

This commit is contained in:
orignal 2016-10-22 20:08:15 -04:00
parent c40a463549
commit 3167ae21b0
3 changed files with 46 additions and 7 deletions

View file

@ -659,6 +659,29 @@ namespace stream
LogPrint (eLogWarning, "Streaming: All leases are expired, sSID=", m_SendStreamID);
}
void Stream::SendUpdatedLeaseSet ()
{
if (m_RoutingSession && m_RoutingSession->IsLeaseSetUpdated ())
{
if (!m_CurrentRemoteLease)
UpdateCurrentRemoteLease (true);
if (m_CurrentRemoteLease)
{
auto msg = m_RoutingSession->WrapSingleMessage (nullptr);
auto outboundTunnel = m_LocalDestination.GetOwner ()->GetTunnelPool ()->GetNextOutboundTunnel ();
if (outboundTunnel)
m_CurrentOutboundTunnel->SendTunnelDataMsg (
{
i2p::tunnel::TunnelMessageBlock
{
i2p::tunnel::eDeliveryTypeTunnel,
m_CurrentRemoteLease->tunnelGateway, m_CurrentRemoteLease->tunnelID,
msg
}
});
}
}
}
void Stream::ScheduleResend ()
{
@ -760,7 +783,10 @@ namespace stream
{
m_RemoteLeaseSet = m_LocalDestination.GetOwner ()->FindLeaseSet (m_RemoteIdentity->GetIdentHash ());
if (!m_RemoteLeaseSet)
{
LogPrint (eLogWarning, "Streaming: LeaseSet ", m_RemoteIdentity->GetIdentHash ().ToBase64 (), " not found");
m_LocalDestination.GetOwner ()->RequestDestination (m_RemoteIdentity->GetIdentHash ()); // try to request for a next attempt
}
}
if (m_RemoteLeaseSet)
{