|
|
@ -19,7 +19,7 @@ namespace stream |
|
|
|
const i2p::data::LeaseSet& remote): m_Service (service), m_SendStreamID (0), |
|
|
|
const i2p::data::LeaseSet& remote): m_Service (service), m_SendStreamID (0), |
|
|
|
m_SequenceNumber (0), m_LastReceivedSequenceNumber (0), m_IsOpen (false), |
|
|
|
m_SequenceNumber (0), m_LastReceivedSequenceNumber (0), m_IsOpen (false), |
|
|
|
m_LeaseSetUpdated (true), m_LocalDestination (local), m_RemoteLeaseSet (remote), |
|
|
|
m_LeaseSetUpdated (true), m_LocalDestination (local), m_RemoteLeaseSet (remote), |
|
|
|
m_OutboundTunnel (nullptr), m_ReceiveTimer (m_Service) |
|
|
|
m_ReceiveTimer (m_Service) |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_RecvStreamID = i2p::context.GetRandomNumberGenerator ().GenerateWord32 (); |
|
|
|
m_RecvStreamID = i2p::context.GetRandomNumberGenerator ().GenerateWord32 (); |
|
|
|
UpdateCurrentRemoteLease (); |
|
|
|
UpdateCurrentRemoteLease (); |
|
|
@ -75,9 +75,7 @@ namespace stream |
|
|
|
// we have received duplicate. Most likely our outbound tunnel is dead
|
|
|
|
// we have received duplicate. Most likely our outbound tunnel is dead
|
|
|
|
LogPrint ("Duplicate message ", receivedSeqn, " received"); |
|
|
|
LogPrint ("Duplicate message ", receivedSeqn, " received"); |
|
|
|
UpdateCurrentRemoteLease (); // pick another lease
|
|
|
|
UpdateCurrentRemoteLease (); // pick another lease
|
|
|
|
m_OutboundTunnel = i2p::tunnel::tunnels.GetNextOutboundTunnel (); // pick another tunnel
|
|
|
|
SendQuickAck (); // resend ack for previous message again
|
|
|
|
if (m_OutboundTunnel) |
|
|
|
|
|
|
|
SendQuickAck (); // resend ack for previous message again
|
|
|
|
|
|
|
|
delete packet; // packet dropped
|
|
|
|
delete packet; // packet dropped
|
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
@ -292,16 +290,15 @@ namespace stream |
|
|
|
|
|
|
|
|
|
|
|
I2NPMessage * msg = i2p::garlic::routing.WrapMessage (m_RemoteLeaseSet, |
|
|
|
I2NPMessage * msg = i2p::garlic::routing.WrapMessage (m_RemoteLeaseSet, |
|
|
|
CreateDataMessage (this, buf, len), leaseSet); |
|
|
|
CreateDataMessage (this, buf, len), leaseSet); |
|
|
|
if (!m_OutboundTunnel || m_OutboundTunnel->IsFailed ()) |
|
|
|
auto outboundTunnel = m_LocalDestination->GetTunnelPool ()->GetNextOutboundTunnel (); |
|
|
|
m_OutboundTunnel = m_LocalDestination->GetTunnelPool ()->GetNextOutboundTunnel (); |
|
|
|
if (outboundTunnel) |
|
|
|
if (m_OutboundTunnel) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
auto ts = i2p::util::GetMillisecondsSinceEpoch (); |
|
|
|
auto ts = i2p::util::GetMillisecondsSinceEpoch (); |
|
|
|
if (ts >= m_CurrentRemoteLease.endDate) |
|
|
|
if (ts >= m_CurrentRemoteLease.endDate) |
|
|
|
UpdateCurrentRemoteLease (); |
|
|
|
UpdateCurrentRemoteLease (); |
|
|
|
if (ts < m_CurrentRemoteLease.endDate) |
|
|
|
if (ts < m_CurrentRemoteLease.endDate) |
|
|
|
{ |
|
|
|
{ |
|
|
|
m_OutboundTunnel->SendTunnelDataMsg (m_CurrentRemoteLease.tunnelGateway, m_CurrentRemoteLease.tunnelID, msg); |
|
|
|
outboundTunnel->SendTunnelDataMsg (m_CurrentRemoteLease.tunnelGateway, m_CurrentRemoteLease.tunnelID, msg); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|