mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-09-13 14:52:14 +00:00
reduce the dht traffic load due to mostly useless tracker requests
This commit is contained in:
parent
cb9e637ac6
commit
aa312dfc39
@ -2111,10 +2111,15 @@ namespace libtorrent
|
|||||||
int port = m_ses.listen_port();
|
int port = m_ses.listen_port();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
boost::weak_ptr<torrent> self(shared_from_this());
|
// this is where the tracker request is made. if we have enough connections already don't bother
|
||||||
m_ses.m_dht->announce(name(), m_torrent_file->info_hash()
|
// invoking the tracker again so we should prevent useless traffic.
|
||||||
, m_ses.external_address().external_address(address_v4()), port, is_seed(), true, m_policy.num_peers()
|
// peer exchange protocol will obtain new peers anyway.
|
||||||
, boost::bind(&torrent::on_dht_announce_response_disp, self, _1));
|
if( m_allow_peers && int(m_connections.size()) < 8 ) {
|
||||||
|
boost::weak_ptr<torrent> self(shared_from_this());
|
||||||
|
m_ses.m_dht->announce(name(), m_torrent_file->info_hash()
|
||||||
|
, m_ses.external_address().external_address(address_v4()), port, is_seed(), true, m_policy.num_peers()
|
||||||
|
, boost::bind(&torrent::on_dht_announce_response_disp, self, _1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrent::on_dht_announce_response_disp(boost::weak_ptr<libtorrent::torrent> t
|
void torrent::on_dht_announce_response_disp(boost::weak_ptr<libtorrent::torrent> t
|
||||||
|
Loading…
x
Reference in New Issue
Block a user