|
|
@ -432,6 +432,8 @@ namespace libtorrent |
|
|
|
, m_is_active_download(false) |
|
|
|
, m_is_active_download(false) |
|
|
|
, m_is_active_finished(false) |
|
|
|
, m_is_active_finished(false) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if (!p.name.empty()) m_name.reset(new std::string(p.name)); |
|
|
|
|
|
|
|
|
|
|
|
// if there is resume data already, we don't need to trigger the initial save
|
|
|
|
// if there is resume data already, we don't need to trigger the initial save
|
|
|
|
// resume data
|
|
|
|
// resume data
|
|
|
|
if (!p.resume_data.empty() && (p.flags & add_torrent_params::flag_override_resume_data) == 0) |
|
|
|
if (!p.resume_data.empty() && (p.flags & add_torrent_params::flag_override_resume_data) == 0) |
|
|
@ -467,10 +469,6 @@ namespace libtorrent |
|
|
|
m_connections_initialized = true; |
|
|
|
m_connections_initialized = true; |
|
|
|
m_block_size_shift = root2((std::min)(block_size, m_torrent_file->piece_length())); |
|
|
|
m_block_size_shift = root2((std::min)(block_size, m_torrent_file->piece_length())); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (!p.name.empty()) m_name.reset(new std::string(p.name)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!m_url.empty() && m_uuid.empty()) m_uuid = m_url; |
|
|
|
if (!m_url.empty() && m_uuid.empty()) m_uuid = m_url; |
|
|
|
|
|
|
|
|
|
|
@ -2097,6 +2095,7 @@ namespace libtorrent |
|
|
|
{ |
|
|
|
{ |
|
|
|
TORRENT_ASSERT(m_ses.is_network_thread()); |
|
|
|
TORRENT_ASSERT(m_ses.is_network_thread()); |
|
|
|
if (!m_ses.m_dht) return; |
|
|
|
if (!m_ses.m_dht) return; |
|
|
|
|
|
|
|
if (!m_name) return; |
|
|
|
if (!should_announce_dht()) return; |
|
|
|
if (!should_announce_dht()) return; |
|
|
|
|
|
|
|
|
|
|
|
TORRENT_ASSERT(m_allow_peers); |
|
|
|
TORRENT_ASSERT(m_allow_peers); |
|
|
@ -2110,7 +2109,7 @@ namespace libtorrent |
|
|
|
policy::peer const* p = *i; |
|
|
|
policy::peer const* p = *i; |
|
|
|
|
|
|
|
|
|
|
|
if( p->connectable && !p->banned ) { |
|
|
|
if( p->connectable && !p->banned ) { |
|
|
|
m_ses.m_dht->announce(*m_name, m_torrent_file->info_hash() |
|
|
|
m_ses.m_dht->announce(name(), m_torrent_file->info_hash() |
|
|
|
, p->address(), p->port, p->seed, false |
|
|
|
, p->address(), p->port, p->seed, false |
|
|
|
, boost::bind(&nop)); |
|
|
|
, boost::bind(&nop)); |
|
|
|
} |
|
|
|
} |
|
|
@ -2124,7 +2123,7 @@ namespace libtorrent |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
boost::weak_ptr<torrent> self(shared_from_this()); |
|
|
|
boost::weak_ptr<torrent> self(shared_from_this()); |
|
|
|
m_ses.m_dht->announce(*m_name, m_torrent_file->info_hash() |
|
|
|
m_ses.m_dht->announce(name(), m_torrent_file->info_hash() |
|
|
|
, m_ses.external_address().external_address(address_v4()), port, is_seed(), true |
|
|
|
, m_ses.external_address().external_address(address_v4()), port, is_seed(), true |
|
|
|
, boost::bind(&torrent::on_dht_announce_response_disp, self, _1)); |
|
|
|
, boost::bind(&torrent::on_dht_announce_response_disp, self, _1)); |
|
|
|
} |
|
|
|
} |
|
|
|