From 2c5151def589a2fc7fe53e2cdc68a514b49a1110 Mon Sep 17 00:00:00 2001 From: rakshasa Date: Tue, 20 Dec 2005 19:12:15 +0000 Subject: [PATCH] * Checked and fixed calls to priority_queue_insert to make sure they don't end up in an infinite loop. * Fixed a bug that caused failed chunk downloads to result in ChunkSelector's forgetting to download them again. * Added note to the man page about the schedule and schedule_remove setting. * Display the number of failed chunks in the client. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@612 e378c898-3ddf-0310-93e7-cc216c733640 --- doc/rtorrent.1.xml | 22 ++++++++++++++++++++++ doc/rtorrent.rc | 8 ++++++-- src/core/download.cc | 8 ++++++++ src/core/download.h | 5 +++++ src/display/canvas.h | 4 ++++ src/display/window_download_statusbar.cc | 5 +++-- 6 files changed, 48 insertions(+), 4 deletions(-) diff --git a/doc/rtorrent.1.xml b/doc/rtorrent.1.xml index 9d134ed9..5161662d 100644 --- a/doc/rtorrent.1.xml +++ b/doc/rtorrent.1.xml @@ -414,6 +414,28 @@ + + schedule = id,start,interval,command + + +Call command every interval +seconds, starting from start. An +interval of zero calls the task once, while a +start of zero calls it immediately. Currently +command is forwarded to the option handler. + + + + + + schedule_remove = id + + + Delete id from the scheduler. + + + + diff --git a/doc/rtorrent.rc b/doc/rtorrent.rc index ddbe4313..c5115272 100644 --- a/doc/rtorrent.rc +++ b/doc/rtorrent.rc @@ -27,11 +27,11 @@ #session = ./session # The ip address reported to the tracker. -#ip = 127.0.0.1 +#ip = rakshasa # The ip address the listening socket and outgoing connections is # bound to. -#bind = 127.0.0.1 +#bind = rakshasa # Port range to use for listening. #port_range = 6890-6999 @@ -46,6 +46,10 @@ # Set whetever the client should try to connect to UDP trackers. #use_udp_trackers = yes +# Alternative calls to bind and ip that should handle dynamic ip's. +#schedule = ip_tick,0,1800,ip=rakshasa +#schedule = bind_tick,0,1800,bind=rakshasa + # # Do not modify the following parameters unless you know what you're doing. # diff --git a/src/core/download.cc b/src/core/download.cc index 8ecd029e..5af33f1d 100644 --- a/src/core/download.cc +++ b/src/core/download.cc @@ -47,6 +47,7 @@ namespace core { Download::Download() : + m_chunksFailed(0), m_connectionLeech(torrent::Download::CONNECTION_LEECH), m_connectionSeed(torrent::Download::CONNECTION_SEED) { } @@ -71,6 +72,8 @@ Download::set_download(torrent::Download d) { m_connTrackerSucceded = m_download.signal_tracker_succeded(sigc::bind(sigc::mem_fun(*this, &Download::receive_tracker_msg), "")); m_connTrackerFailed = m_download.signal_tracker_failed(sigc::mem_fun(*this, &Download::receive_tracker_msg)); m_connStorageError = m_download.signal_storage_error(sigc::mem_fun(*this, &Download::receive_storage_error)); + + m_download.signal_chunk_failed(sigc::mem_fun(*this, &Download::receive_chunk_failed)); } void @@ -144,4 +147,9 @@ Download::connection_type_to_string(torrent::Download::ConnectionType t) { } } +void +Download::receive_chunk_failed(uint32_t idx) { + m_chunksFailed++; +} + } diff --git a/src/core/download.h b/src/core/download.h index f79a8ea1..2906e11d 100644 --- a/src/core/download.h +++ b/src/core/download.h @@ -65,6 +65,8 @@ public: const std::string& get_message() { return m_message; } + uint32_t chunks_failed() const { return m_chunksFailed; } + void set_root_directory(const std::string& d); ConnType get_connection_current() const { return m_download.connection_type(); } @@ -95,9 +97,12 @@ private: void receive_tracker_msg(std::string msg); void receive_storage_error(std::string msg); + void receive_chunk_failed(uint32_t idx); + torrent::Download m_download; std::string m_message; + uint32_t m_chunksFailed; ConnType m_connectionLeech; ConnType m_connectionSeed; diff --git a/src/display/canvas.h b/src/display/canvas.h index 4a8fe809..e435f241 100644 --- a/src/display/canvas.h +++ b/src/display/canvas.h @@ -103,6 +103,10 @@ public: void print(int x, int y, char* str, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) { mvwprintw(m_window, y, x, str, a1, a2, a3, a4, a5, a6, a7); } + template + void print(int x, int y, char* str, + A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) { mvwprintw(m_window, y, x, str, a1, a2, a3, a4, a5, a6, a7, a8); } + void set_attr(int x, int y, int n, int attr, int color) { mvwchgat(m_window, y, x, n, attr, color, NULL); } // Initialize stdscr. diff --git a/src/display/window_download_statusbar.cc b/src/display/window_download_statusbar.cc index bd08e8ce..7a814eaf 100644 --- a/src/display/window_download_statusbar.cc +++ b/src/display/window_download_statusbar.cc @@ -65,14 +65,15 @@ WindowDownloadStatusbar::redraw() { position = print_download_info(buffer, last - buffer, m_download); m_canvas->print(0, 0, "%s", buffer); - m_canvas->print(0, 1, "Peers: %i(%i) Min/Max: %i/%i Uploads: %i U/I: %i/%i", + m_canvas->print(0, 1, "Peers: %i(%i) Min/Max: %i/%i Uploads: %i U/I: %i/%i Failed: %i", (int)m_download->get_download().peers_connected(), (int)m_download->get_download().peers_not_connected(), (int)m_download->get_download().peers_min(), (int)m_download->get_download().peers_max(), (int)m_download->get_download().uploads_max(), (int)m_download->get_download().peers_currently_unchoked(), - (int)m_download->get_download().peers_currently_interested()); + (int)m_download->get_download().peers_currently_interested(), + (int)m_download->chunks_failed()); position = print_download_status(buffer, last - buffer, m_download); m_canvas->print(0, 2, "[%c:%i] %s",