fixed problem when aborting checking torrents
This commit is contained in:
parent
23fbb8d240
commit
6db55b87ab
|
@ -195,7 +195,8 @@ namespace libtorrent
|
|||
write_char(out, 'e');
|
||||
break;
|
||||
default:
|
||||
throw invalid_encoding();
|
||||
// do nothing
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -118,6 +118,14 @@ namespace libtorrent { namespace detail
|
|||
t = m_torrents.front();
|
||||
if (t->abort)
|
||||
{
|
||||
if (processing->torrent_ptr->num_peers())
|
||||
{
|
||||
m_ses.m_torrents.insert(std::make_pair(
|
||||
t->info_hash, t->torrent_ptr));
|
||||
t->torrent_ptr->abort();
|
||||
}
|
||||
|
||||
|
||||
m_torrents.pop_front();
|
||||
continue;
|
||||
}
|
||||
|
@ -238,6 +246,13 @@ namespace libtorrent { namespace detail
|
|||
assert(!m_processing.empty());
|
||||
assert(m_processing.front() == processing);
|
||||
|
||||
if (processing->torrent_ptr->num_peers())
|
||||
{
|
||||
m_ses.m_torrents.insert(std::make_pair(
|
||||
processing->info_hash, processing->torrent_ptr));
|
||||
processing->torrent_ptr->abort();
|
||||
}
|
||||
|
||||
processing.reset();
|
||||
m_processing.pop_front();
|
||||
if (!m_processing.empty())
|
||||
|
|
|
@ -860,21 +860,21 @@ namespace libtorrent
|
|||
peer_iterator i = m_connections.find(p->get_socket()->sender());
|
||||
assert(i != m_connections.end());
|
||||
|
||||
// if the peer_connection was downloading any pieces
|
||||
// abort them
|
||||
for (std::deque<piece_block>::const_iterator i = p->download_queue().begin();
|
||||
i != p->download_queue().end(); ++i)
|
||||
if (ready_for_connections())
|
||||
{
|
||||
m_picker->abort_download(*i);
|
||||
}
|
||||
for (std::deque<piece_block>::const_iterator i = p->request_queue().begin();
|
||||
i != p->request_queue().end(); ++i)
|
||||
{
|
||||
m_picker->abort_download(*i);
|
||||
}
|
||||
// if the peer_connection was downloading any pieces
|
||||
// abort them
|
||||
for (std::deque<piece_block>::const_iterator i = p->download_queue().begin();
|
||||
i != p->download_queue().end(); ++i)
|
||||
{
|
||||
m_picker->abort_download(*i);
|
||||
}
|
||||
for (std::deque<piece_block>::const_iterator i = p->request_queue().begin();
|
||||
i != p->request_queue().end(); ++i)
|
||||
{
|
||||
m_picker->abort_download(*i);
|
||||
}
|
||||
|
||||
if (valid_metadata())
|
||||
{
|
||||
std::vector<int> piece_list;
|
||||
const std::vector<bool>& pieces = p->get_bitfield();
|
||||
|
||||
|
|
Loading…
Reference in New Issue