fixed connect candidate logic, to prefer peers with less failures
This commit is contained in:
parent
e0d1951fac
commit
4b7eaf8cbe
|
@ -533,6 +533,12 @@ namespace libtorrent
|
||||||
if (i->second.type == peer::not_connectable) continue;
|
if (i->second.type == peer::not_connectable) continue;
|
||||||
if (i->second.seed && finished) continue;
|
if (i->second.seed && finished) continue;
|
||||||
if (i->second.failcount >= max_failcount) continue;
|
if (i->second.failcount >= max_failcount) continue;
|
||||||
|
|
||||||
|
// prefer peers with lower failcount
|
||||||
|
if (candidate != m_peers.end()
|
||||||
|
&& candidate->second.failcount < i->second.failcount)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (now - i->second.connected < seconds(i->second.failcount * min_reconnect_time))
|
if (now - i->second.connected < seconds(i->second.failcount * min_reconnect_time))
|
||||||
continue;
|
continue;
|
||||||
if (ses.m_port_filter.access(i->second.ip.port()) & port_filter::blocked)
|
if (ses.m_port_filter.access(i->second.ip.port()) & port_filter::blocked)
|
||||||
|
|
Loading…
Reference in New Issue