* Added resume functions for saving/loading tracker state.

* Added parameter to torrent::resume_save_progress to indicate that
only completed files are to be saved. This is used when the torrent is
active.

* Update the display when priority is changed.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@746 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2006-07-22 20:41:47 +00:00
parent 652fd25c07
commit ef90f0f51e
5 changed files with 14 additions and 9 deletions
+1
View File
@@ -193,6 +193,7 @@ DownloadFactory::receive_success() {
torrent::resume_load_addresses(*download->download(), resumeObject);
torrent::resume_load_file_priorities(*download->download(), resumeObject);
torrent::resume_load_tracker_settings(*download->download(), resumeObject);
// The action of inserting might cause the torrent to be
// opened/started or such. Figure out a nicer way of handling this.
+1 -1
View File
@@ -321,7 +321,7 @@ DownloadList::resume(Download* download) {
// on non-complete downloads after a crash. This shouldn't be
// needed, but for some reason linux 2.6 is very lazy about
// updating mtime.
torrent::resume_clear_progress(*download->download(), download->download()->bencode()->get_key("libtorrent_resume"));
torrent::resume_save_progress(*download->download(), download->download()->bencode()->get_key("libtorrent_resume"), true);
}
// Update the priority to ensure it has the correct
+5 -2
View File
@@ -109,8 +109,11 @@ DownloadStore::save(Download* d) {
d->bencode()->get_key("rtorrent").insert_key("total_uploaded", d->download()->up_rate()->total());
d->bencode()->get_key("rtorrent").insert_key("chunks_done", d->download()->chunks_done());
torrent::resume_save_addresses(*d->download(), d->download()->bencode()->get_key("libtorrent_resume"));
torrent::resume_save_file_priorities(*d->download(), d->download()->bencode()->get_key("libtorrent_resume"));
torrent::Object& resumeObject = d->download()->bencode()->get_key("libtorrent_resume");
torrent::resume_save_addresses(*d->download(), resumeObject);
torrent::resume_save_file_priorities(*d->download(), resumeObject);
torrent::resume_save_tracker_settings(*d->download(), resumeObject);
f << *d->bencode();
+5 -6
View File
@@ -107,11 +107,11 @@ Manager::unschedule(Window* w) {
void
Manager::adjust_layout() {
int staticHeight = std::for_each(begin(), end(),
rak::if_then(std::mem_fun(&Window::is_active),
rak::accumulate(0, std::mem_fun(&Window::get_min_height)))).m_then.result;
rak::if_then(std::mem_fun(&Window::is_active),
rak::accumulate(0, std::mem_fun(&Window::get_min_height)))).m_then.result;
int countDynamic = std::for_each(begin(), end(),
rak::if_then(std::mem_fun(&Window::is_active),
rak::accumulate(0, std::mem_fun(&Window::is_dynamic)))).m_then.result;
rak::if_then(std::mem_fun(&Window::is_active),
rak::accumulate(0, std::mem_fun(&Window::is_dynamic)))).m_then.result;
int dynamic = std::max(0, Canvas::get_screen_height() - staticHeight);
int height = 0, h;
@@ -166,8 +166,7 @@ Manager::schedule_update() {
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 + 50000));
rak::priority_queue_insert(&taskScheduler, &m_taskUpdate, std::max(m_scheduler.top()->time(), m_timeLastUpdate + 50000));
}
}
+2
View File
@@ -264,6 +264,7 @@ DownloadList::receive_next_priority() {
return;
(*m_view->focus())->set_priority(((*m_view->focus())->priority() + 1) % 4);
(*m_window)->mark_dirty();
}
void
@@ -272,6 +273,7 @@ DownloadList::receive_prev_priority() {
return;
(*m_view->focus())->set_priority(((*m_view->focus())->priority() - 1) % 4);
(*m_window)->mark_dirty();
}
void