renamed some torrent check queue related functions to be more descriptive
This commit is contained in:
parent
3c364731e8
commit
d959331c1e
|
@ -232,8 +232,8 @@ namespace libtorrent
|
||||||
|
|
||||||
std::vector<torrent_handle> get_torrents();
|
std::vector<torrent_handle> get_torrents();
|
||||||
|
|
||||||
void check_torrent(boost::shared_ptr<torrent> const& t);
|
void queue_check_torrent(boost::shared_ptr<torrent> const& t);
|
||||||
void done_checking(boost::shared_ptr<torrent> const& t);
|
void dequeue_check_torrent(boost::shared_ptr<torrent> const& t);
|
||||||
|
|
||||||
void set_alert_mask(int m);
|
void set_alert_mask(int m);
|
||||||
size_t set_alert_queue_size_limit(size_t queue_size_limit_);
|
size_t set_alert_queue_size_limit(size_t queue_size_limit_);
|
||||||
|
@ -496,6 +496,8 @@ namespace libtorrent
|
||||||
tracker_manager m_tracker_manager;
|
tracker_manager m_tracker_manager;
|
||||||
torrent_map m_torrents;
|
torrent_map m_torrents;
|
||||||
typedef std::list<boost::shared_ptr<torrent> > check_queue_t;
|
typedef std::list<boost::shared_ptr<torrent> > check_queue_t;
|
||||||
|
|
||||||
|
// this has all torrents that wants to be checked in it
|
||||||
check_queue_t m_queued_for_checking;
|
check_queue_t m_queued_for_checking;
|
||||||
|
|
||||||
// this maps sockets to their peer_connection
|
// this maps sockets to their peer_connection
|
||||||
|
|
|
@ -2634,7 +2634,7 @@ namespace aux {
|
||||||
return torrent_handle(torrent_ptr);
|
return torrent_handle(torrent_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void session_impl::check_torrent(boost::shared_ptr<torrent> const& t)
|
void session_impl::queue_check_torrent(boost::shared_ptr<torrent> const& t)
|
||||||
{
|
{
|
||||||
if (m_abort) return;
|
if (m_abort) return;
|
||||||
TORRENT_ASSERT(t->should_check_files());
|
TORRENT_ASSERT(t->should_check_files());
|
||||||
|
@ -2646,11 +2646,14 @@ namespace aux {
|
||||||
m_queued_for_checking.push_back(t);
|
m_queued_for_checking.push_back(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
void session_impl::done_checking(boost::shared_ptr<torrent> const& t)
|
void session_impl::dequeue_check_torrent(boost::shared_ptr<torrent> const& t)
|
||||||
{
|
{
|
||||||
INVARIANT_CHECK;
|
INVARIANT_CHECK;
|
||||||
|
TORRENT_ASSERT(t->state() == torrent_status::checking_files
|
||||||
|
|| t->state() == torrent_status::queued_for_checking);
|
||||||
|
|
||||||
if (m_queued_for_checking.empty()) return;
|
if (m_queued_for_checking.empty()) return;
|
||||||
|
|
||||||
boost::shared_ptr<torrent> next_check = *m_queued_for_checking.begin();
|
boost::shared_ptr<torrent> next_check = *m_queued_for_checking.begin();
|
||||||
check_queue_t::iterator done = m_queued_for_checking.end();
|
check_queue_t::iterator done = m_queued_for_checking.end();
|
||||||
for (check_queue_t::iterator i = m_queued_for_checking.begin()
|
for (check_queue_t::iterator i = m_queued_for_checking.begin()
|
||||||
|
@ -2662,10 +2665,12 @@ namespace aux {
|
||||||
next_check = *i;
|
next_check = *i;
|
||||||
}
|
}
|
||||||
// only start a new one if we removed the one that is checking
|
// only start a new one if we removed the one that is checking
|
||||||
|
TORRENT_ASSERT(done != m_queued_for_checking.end());
|
||||||
if (done == m_queued_for_checking.end()) return;
|
if (done == m_queued_for_checking.end()) return;
|
||||||
|
|
||||||
if (next_check != t && t->state() == torrent_status::checking_files)
|
if (next_check != t && t->state() == torrent_status::checking_files)
|
||||||
next_check->start_checking();
|
next_check->start_checking();
|
||||||
|
|
||||||
m_queued_for_checking.erase(done);
|
m_queued_for_checking.erase(done);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1014,14 +1014,14 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
if (m_queued_for_checking) return;
|
if (m_queued_for_checking) return;
|
||||||
m_queued_for_checking = true;
|
m_queued_for_checking = true;
|
||||||
m_ses.check_torrent(shared_from_this());
|
m_ses.queue_check_torrent(shared_from_this());
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrent::dequeue_torrent_check()
|
void torrent::dequeue_torrent_check()
|
||||||
{
|
{
|
||||||
if (!m_queued_for_checking) return;
|
if (!m_queued_for_checking) return;
|
||||||
m_queued_for_checking = false;
|
m_queued_for_checking = false;
|
||||||
m_ses.done_checking(shared_from_this());
|
m_ses.dequeue_check_torrent(shared_from_this());
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrent::force_recheck()
|
void torrent::force_recheck()
|
||||||
|
|
Loading…
Reference in New Issue