don't include same introducer twice

This commit is contained in:
orignal 2014-09-09 08:03:05 -04:00
parent 98fd1c7dbc
commit 5435d20199
4 changed files with 14 additions and 8 deletions

11
SSU.cpp
View file

@ -1156,7 +1156,7 @@ namespace ssu
{
// timeout expired
std::list<boost::asio::ip::udp::endpoint> newList;
int numIntroducers = 0;
size_t numIntroducers = 0;
for (auto it :m_Introducers)
{
auto session = FindSession (it);
@ -1173,13 +1173,16 @@ namespace ssu
if (numIntroducers < SSU_MAX_NUM_INTRODUCERS)
{
// create new
auto introducers = FindIntroducers (SSU_MAX_NUM_INTRODUCERS - numIntroducers);
auto introducers = FindIntroducers (SSU_MAX_NUM_INTRODUCERS);
if (introducers.size () > 0)
{
for (auto it1: introducers)
{
i2p::context.AddIntroducer (*it1->GetRemoteRouter (), it1->GetRelayTag ());
newList.push_back (it1->GetRemoteEndpoint ());
if (i2p::context.AddIntroducer (*it1->GetRemoteRouter (), it1->GetRelayTag ()))
{
newList.push_back (it1->GetRemoteEndpoint ());
if (newList.size () >= SSU_MAX_NUM_INTRODUCERS) break;
}
}
}
}