mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-09 23:59:22 +00:00
Simplify updating queue entries
The erase/insert pattern can be replaced by a single method that updates an existing entry's timer, or inserting if it doesn't exist. This has much less impact than the libtorrent change it's based on, but might as well be consistent.
This commit is contained in:
@@ -64,8 +64,7 @@ Manager::force_redraw() {
|
||||
|
||||
void
|
||||
Manager::schedule(Window* w, rak::timer t) {
|
||||
rak::priority_queue_erase(&m_scheduler, w->task_update());
|
||||
rak::priority_queue_insert(&m_scheduler, w->task_update(), t);
|
||||
rak::priority_queue_update(&m_scheduler, w->task_update(), t);
|
||||
schedule_update(50000);
|
||||
}
|
||||
|
||||
@@ -114,8 +113,7 @@ Manager::schedule_update(uint32_t minInterval) {
|
||||
}
|
||||
|
||||
if (!m_taskUpdate.is_queued() || m_taskUpdate.time() > m_scheduler.top()->time()) {
|
||||
rak::priority_queue_erase(&taskScheduler, &m_taskUpdate);
|
||||
rak::priority_queue_insert(&taskScheduler, &m_taskUpdate, std::max(m_scheduler.top()->time(), m_timeLastUpdate + minInterval));
|
||||
rak::priority_queue_update(&taskScheduler, &m_taskUpdate, std::max(m_scheduler.top()->time(), m_timeLastUpdate + minInterval));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user