prioritizes local peers over non-local ones when finding connect candidates

This commit is contained in:
Arvid Norberg 2007-12-22 18:20:23 +00:00
parent b23e9e3795
commit 91ecbb4b23
1 changed files with 8 additions and 0 deletions

View File

@ -540,6 +540,14 @@ namespace libtorrent
TORRENT_ASSERT(i->second.connected <= now);
// don't replace a candidate that is on the local
// network with one that isn't. Local peers should
// always be tried first
if (candidate != m_peers.end()
&& is_local(candidate->second.ip.address())
&& !is_local(i->second.ip.address()))
continue;
if (i->second.connected <= min_connect_time)
{
min_connect_time = i->second.connected;