mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
don't pick same session for PeerTest msg 2
This commit is contained in:
parent
baf74cb582
commit
463ed12ce8
3 changed files with 10 additions and 5 deletions
|
@ -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
|
|||
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
|
|||
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--;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue