simplified want_peers expression
This commit is contained in:
parent
862844e546
commit
d2c64915bf
|
@ -7649,19 +7649,33 @@ namespace libtorrent
|
||||||
update_list(aux::session_interface::torrent_want_tick, want_tick());
|
update_list(aux::session_interface::torrent_want_tick, want_tick());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// returns true if this torrent is interested in connecting to more peers
|
||||||
bool torrent::want_peers() const
|
bool torrent::want_peers() const
|
||||||
{
|
{
|
||||||
return m_connections.size() < m_max_connections
|
// if all our connection slots are taken, we can't connect to more
|
||||||
&& !is_paused()
|
if (m_connections.size() >= m_max_connections) return false;
|
||||||
&& ((m_state != torrent_status::checking_files
|
|
||||||
&& m_state != torrent_status::checking_resume_data)
|
// if we're paused, obviously we're not connecting to peers
|
||||||
|| !valid_metadata())
|
if (is_paused() || m_abort) return false;
|
||||||
&& m_policy
|
|
||||||
&& m_policy->num_connect_candidates() > 0
|
if ((m_state == torrent_status::checking_files
|
||||||
&& !m_abort
|
|| m_state == torrent_status::checking_resume_data)
|
||||||
&& (m_ses.settings().get_bool(settings_pack::seeding_outgoing_connections)
|
&& valid_metadata())
|
||||||
|| (m_state != torrent_status::seeding
|
return false;
|
||||||
&& m_state != torrent_status::finished));
|
|
||||||
|
// if we don't know of any more potential peers to connect to, there's
|
||||||
|
// no point in trying
|
||||||
|
if (!m_policy || m_policy->num_connect_candidates() == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// if the user disabled outgoing connections for seeding torrents,
|
||||||
|
// don't make any
|
||||||
|
if (!m_ses.settings().get_bool(settings_pack::seeding_outgoing_connections)
|
||||||
|
&& (m_state == torrent_status::seeding
|
||||||
|
|| m_state == torrent_status::finished))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool torrent::want_peers_download() const
|
bool torrent::want_peers_download() const
|
||||||
|
|
Loading…
Reference in New Issue