|
|
@ -608,17 +608,16 @@ namespace stream |
|
|
|
LogPrint (eLogInfo, "All leases are expired. Trying to request"); |
|
|
|
LogPrint (eLogInfo, "All leases are expired. Trying to request"); |
|
|
|
m_RemoteLeaseSet = nullptr; |
|
|
|
m_RemoteLeaseSet = nullptr; |
|
|
|
m_LocalDestination.GetOwner ().RequestDestination (m_RemoteIdentity.GetIdentHash (), |
|
|
|
m_LocalDestination.GetOwner ().RequestDestination (m_RemoteIdentity.GetIdentHash (), |
|
|
|
std::bind (&Stream::HandleLeaseSetRequestComplete, shared_from_this (), |
|
|
|
std::bind (&Stream::HandleLeaseSetRequestComplete, shared_from_this (), std::placeholders::_1)); |
|
|
|
std::placeholders::_1, packets)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Stream::HandleLeaseSetRequestComplete (bool success, std::vector<Packet *> packets) |
|
|
|
void Stream::HandleLeaseSetRequestComplete (bool success) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (success) |
|
|
|
if (success) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint (eLogInfo, "New LeaseSet found. Sending packets"); |
|
|
|
LogPrint (eLogInfo, "New LeaseSet found"); |
|
|
|
SendPackets (packets); |
|
|
|
UpdateCurrentRemoteLease (); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -717,6 +716,9 @@ namespace stream |
|
|
|
if (!leases.empty ()) |
|
|
|
if (!leases.empty ()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
uint32_t i = i2p::context.GetRandomNumberGenerator ().GenerateWord32 (0, leases.size () - 1); |
|
|
|
uint32_t i = i2p::context.GetRandomNumberGenerator ().GenerateWord32 (0, leases.size () - 1); |
|
|
|
|
|
|
|
if (m_CurrentRemoteLease.endDate && leases[i].tunnelID == m_CurrentRemoteLease.tunnelID) |
|
|
|
|
|
|
|
// make sure we don't select previous
|
|
|
|
|
|
|
|
i = (i + 1) % leases.size (); // if so, pick next
|
|
|
|
m_CurrentRemoteLease = leases[i]; |
|
|
|
m_CurrentRemoteLease = leases[i]; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|