|
|
|
@ -291,7 +291,8 @@ namespace transport
@@ -291,7 +291,8 @@ namespace transport
|
|
|
|
|
m_PendingOutgoingSessions.erase (ep); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
std::shared_ptr<SSU2Session> SSU2Server::GetRandomSession (i2p::data::RouterInfo::CompatibleTransports remoteTransports) const |
|
|
|
|
std::shared_ptr<SSU2Session> SSU2Server::GetRandomSession ( |
|
|
|
|
i2p::data::RouterInfo::CompatibleTransports remoteTransports, const i2p::data::IdentHash& excluded) const |
|
|
|
|
{ |
|
|
|
|
if (m_Sessions.empty ()) return nullptr; |
|
|
|
|
uint16_t ind; |
|
|
|
@ -301,7 +302,8 @@ namespace transport
@@ -301,7 +302,8 @@ namespace transport
|
|
|
|
|
std::advance (it, ind); |
|
|
|
|
while (it != m_Sessions.end ()) |
|
|
|
|
{ |
|
|
|
|
if (it->second->GetRemoteTransports () & remoteTransports) |
|
|
|
|
if ((it->second->GetRemoteTransports () & remoteTransports) && |
|
|
|
|
it->second->GetRemoteIdentity ()->GetIdentHash () != excluded) |
|
|
|
|
return it->second; |
|
|
|
|
it++; |
|
|
|
|
} |
|
|
|
@ -309,7 +311,8 @@ namespace transport
@@ -309,7 +311,8 @@ namespace transport
|
|
|
|
|
it = m_Sessions.begin (); |
|
|
|
|
while (it != m_Sessions.end () && ind) |
|
|
|
|
{ |
|
|
|
|
if (it->second->GetRemoteTransports () & remoteTransports) |
|
|
|
|
if ((it->second->GetRemoteTransports () & remoteTransports) && |
|
|
|
|
it->second->GetRemoteIdentity ()->GetIdentHash () != excluded) |
|
|
|
|
return it->second; |
|
|
|
|
it++; ind--; |
|
|
|
|
} |
|
|
|
|