forked from premiere/premiere-libtorrent
piece picker fix
This commit is contained in:
parent
6c8ef08e56
commit
a9d18439e9
|
@ -643,28 +643,26 @@ namespace libtorrent
|
||||||
|
|
||||||
assert(p.downloading == 1);
|
assert(p.downloading == 1);
|
||||||
assert(!p.have());
|
assert(!p.have());
|
||||||
|
|
||||||
|
std::vector<downloading_piece>::iterator i
|
||||||
|
= std::find_if(m_downloads.begin()
|
||||||
|
, m_downloads.end()
|
||||||
|
, has_index(index));
|
||||||
|
assert(i != m_downloads.end());
|
||||||
|
m_downloads.erase(i);
|
||||||
|
p.downloading = 0;
|
||||||
|
|
||||||
|
assert(std::find_if(m_downloads.begin()
|
||||||
|
, m_downloads.end()
|
||||||
|
, has_index(index)) == m_downloads.end());
|
||||||
|
|
||||||
if (p.filtered())
|
if (p.filtered())
|
||||||
{
|
{
|
||||||
--m_num_filtered;
|
--m_num_filtered;
|
||||||
++m_num_have_filtered;
|
++m_num_have_filtered;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
if (p.have()) return;
|
if (p.have()) return;
|
||||||
p.set_have();
|
p.set_have();
|
||||||
if (p.downloading)
|
|
||||||
{
|
|
||||||
std::vector<downloading_piece>::iterator i
|
|
||||||
= std::find_if(m_downloads.begin(),
|
|
||||||
m_downloads.end(),
|
|
||||||
has_index(index));
|
|
||||||
assert(i != m_downloads.end());
|
|
||||||
m_downloads.erase(i);
|
|
||||||
p.downloading = 0;
|
|
||||||
|
|
||||||
assert(std::find_if(m_downloads.begin(),
|
|
||||||
m_downloads.end(),
|
|
||||||
has_index(index)) == m_downloads.end());
|
|
||||||
}
|
|
||||||
assert(p.priority(m_sequenced_download_threshold) == 0);
|
assert(p.priority(m_sequenced_download_threshold) == 0);
|
||||||
move(priority, info_index);
|
move(priority, info_index);
|
||||||
}
|
}
|
||||||
|
|
|
@ -965,10 +965,9 @@ namespace libtorrent { namespace detail
|
||||||
{
|
{
|
||||||
torrent& t = *i->second;
|
torrent& t = *i->second;
|
||||||
assert(!t.is_aborted());
|
assert(!t.is_aborted());
|
||||||
if (t.should_request())
|
if (t.should_request() && m_external_listen_port > 0)
|
||||||
{
|
{
|
||||||
tracker_request req = t.generate_tracker_request();
|
tracker_request req = t.generate_tracker_request();
|
||||||
assert(m_external_listen_port > 0);
|
|
||||||
req.listen_port = m_external_listen_port;
|
req.listen_port = m_external_listen_port;
|
||||||
req.key = m_key;
|
req.key = m_key;
|
||||||
m_tracker_manager.queue_request(m_strand, req, t.tracker_login()
|
m_tracker_manager.queue_request(m_strand, req, t.tracker_login()
|
||||||
|
|
Loading…
Reference in New Issue