From ca4db7aab21057aab8d3fd2e023420c9d4809bb2 Mon Sep 17 00:00:00 2001 From: orignal Date: Tue, 17 Sep 2024 20:56:00 -0400 Subject: [PATCH] handle siuatuion if only one lease in remote LeaseSet --- libi2pd/Streaming.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libi2pd/Streaming.cpp b/libi2pd/Streaming.cpp index 75dce5fa..08347623 100644 --- a/libi2pd/Streaming.cpp +++ b/libi2pd/Streaming.cpp @@ -1460,16 +1460,19 @@ namespace stream break; } } - if (!updated && leases.size () > 1) + if (!updated) { uint32_t i = m_LocalDestination.GetRandom () % leases.size (); if (m_CurrentRemoteLease && leases[i]->tunnelID == m_CurrentRemoteLease->tunnelID) + { // 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]; } - else - isLeaseChanged = false; } else {