Browse Source

handle siuatuion if only one lease in remote LeaseSet

pull/2101/head
orignal 2 months ago
parent
commit
ca4db7aab2
  1. 11
      libi2pd/Streaming.cpp

11
libi2pd/Streaming.cpp

@ -1460,16 +1460,19 @@ namespace stream
break; break;
} }
} }
if (!updated && leases.size () > 1) if (!updated)
{ {
uint32_t i = m_LocalDestination.GetRandom () % leases.size (); uint32_t i = m_LocalDestination.GetRandom () % leases.size ();
if (m_CurrentRemoteLease && leases[i]->tunnelID == m_CurrentRemoteLease->tunnelID) if (m_CurrentRemoteLease && leases[i]->tunnelID == m_CurrentRemoteLease->tunnelID)
{
// make sure we don't select previous // make sure we don't select previous
i = (i + 1) % leases.size (); // if so, pick next if (leases.size () > 1)
i = (i + 1) % leases.size (); // if so, pick next
else
isLeaseChanged = false;
}
m_CurrentRemoteLease = leases[i]; m_CurrentRemoteLease = leases[i];
} }
else
isLeaseChanged = false;
} }
else else
{ {

Loading…
Cancel
Save