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.seed && finished) 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))
|
||||
continue;
|
||||
if (ses.m_port_filter.access(i->second.ip.port()) & port_filter::blocked)
|
||||
|
|
Loading…
Reference in New Issue