mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-11-16 15:57:39 +00:00
Skip duplicates in the saved peers list
This commit is contained in:
parent
fda80e3556
commit
25ef5733a7
1 changed files with 12 additions and 1 deletions
|
@ -310,7 +310,18 @@ void P2PServer::load_saved_peer_list()
|
|||
p.m_port = port;
|
||||
p.m_numFailedConnections = 0;
|
||||
}
|
||||
m_peerList.push_back(p);
|
||||
|
||||
bool already_added = false;
|
||||
for (const Peer& peer : m_peerList) {
|
||||
if ((peer.m_isV6 == p.m_isV6) && (peer.m_addr == p.m_addr)) {
|
||||
already_added = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!already_added) {
|
||||
m_peerList.push_back(p);
|
||||
}
|
||||
});
|
||||
LOGINFO(5, "peer list loaded (" << m_peerList.size() << " peers)");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue