fixed problem when aborting checking torrents

This commit is contained in:
Arvid Norberg 2005-10-16 21:14:08 +00:00
parent 23fbb8d240
commit 6db55b87ab
3 changed files with 30 additions and 14 deletions

View File

@ -195,7 +195,8 @@ namespace libtorrent
write_char(out, 'e');
break;
default:
throw invalid_encoding();
// do nothing
break;
}
}

View File

@ -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())

View File

@ -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();