|
|
@ -291,7 +291,8 @@ namespace transport |
|
|
|
m_PendingOutgoingSessions.erase (ep); |
|
|
|
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; |
|
|
|
if (m_Sessions.empty ()) return nullptr; |
|
|
|
uint16_t ind; |
|
|
|
uint16_t ind; |
|
|
@ -301,7 +302,8 @@ namespace transport |
|
|
|
std::advance (it, ind); |
|
|
|
std::advance (it, ind); |
|
|
|
while (it != m_Sessions.end ()) |
|
|
|
while (it != m_Sessions.end ()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (it->second->GetRemoteTransports () & remoteTransports) |
|
|
|
if ((it->second->GetRemoteTransports () & remoteTransports) && |
|
|
|
|
|
|
|
it->second->GetRemoteIdentity ()->GetIdentHash () != excluded) |
|
|
|
return it->second; |
|
|
|
return it->second; |
|
|
|
it++; |
|
|
|
it++; |
|
|
|
} |
|
|
|
} |
|
|
@ -309,7 +311,8 @@ namespace transport |
|
|
|
it = m_Sessions.begin (); |
|
|
|
it = m_Sessions.begin (); |
|
|
|
while (it != m_Sessions.end () && ind) |
|
|
|
while (it != m_Sessions.end () && ind) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (it->second->GetRemoteTransports () & remoteTransports) |
|
|
|
if ((it->second->GetRemoteTransports () & remoteTransports) && |
|
|
|
|
|
|
|
it->second->GetRemoteIdentity ()->GetIdentHash () != excluded) |
|
|
|
return it->second; |
|
|
|
return it->second; |
|
|
|
it++; ind--; |
|
|
|
it++; ind--; |
|
|
|
} |
|
|
|
} |
|
|
|