diff --git a/README b/README index 8a43b55b..71a4ab2f 100644 --- a/README +++ b/README @@ -1,22 +1,24 @@ Options and flags: - -p Open a port in the range a to b. + -i Set the IP address sent to the tracker. - -s Use as the session directory. The torrents will be - saved with the info-hash in hex as the filename. + -p Open a port in the range a to b. + + -s Use as the session directory. The torrents will be + saved with the info-hash in hex as the filename. All: - Ctrl-Q - Quit + Ctrl-Q - Quit - A - Increase Throttle by 1 KiB - Z - Decrease Throttle by 1 KiB + A - Increase Throttle by 1 KiB + Z - Decrease Throttle by 1 KiB - S - Increase Throttle by 5 KiB - X - Decrease Throttle by 5 KiB + S - Increase Throttle by 5 KiB + X - Decrease Throttle by 5 KiB - D - Increase Throttle by 50 KiB - C - Decrease Throttle by 50 KiB + D - Increase Throttle by 50 KiB + C - Decrease Throttle by 50 KiB In main window: diff --git a/configure.ac b/configure.ac index 3257afc0..bad33c55 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT(rtorrent, 0.0.3, jaris@ifi.uio.no) +AC_INIT(rtorrent, 0.1.1, jaris@ifi.uio.no) AM_INIT_AUTOMAKE AM_CONFIG_HEADER(config.h) @@ -39,7 +39,7 @@ TORRENT_CHECK_EXECINFO() TORRENT_CHECK_CURL() TORRENT_OTFD() -PKG_CHECK_MODULES(STUFF, sigc++-2.0 libtorrent >= 0.4.11, +PKG_CHECK_MODULES(STUFF, sigc++-2.0 libtorrent >= 0.5.0, CXXFLAGS="$CXXFLAGS $STUFF_CFLAGS $CURL_CFLAGS"; LIBS="$LIBS $STUFF_LIBS $CURL_LIBS") diff --git a/src/core/download.cc b/src/core/download.cc index c2a03848..1d480113 100644 --- a/src/core/download.cc +++ b/src/core/download.cc @@ -3,6 +3,7 @@ #include "download.h" #include +#include #include namespace core { @@ -11,7 +12,7 @@ void Download::set_download(torrent::Download d) { m_download = d; - m_connTrackerSucceded = m_download.signal_tracker_succeded(sigc::bind(sigc::mem_fun(*this, &Download::receive_tracker_msg), "")); + m_connTrackerSucceded = m_download.signal_tracker_succeded(sigc::hide(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)); } diff --git a/src/core/manager.cc b/src/core/manager.cc index 2c2b38b9..a5e821de 100644 --- a/src/core/manager.cc +++ b/src/core/manager.cc @@ -6,7 +6,9 @@ #include #include #include +#include #include +#include #include #include @@ -138,7 +140,23 @@ Manager::create_final(std::istream* s) { start(*itr); m_downloadStore.save(*itr); + if (m_debugTracker >= 0) + (*itr)->get_download().signal_tracker_succeded(sigc::mem_fun(*this, &Manager::receive_debug_tracker)); + return itr; } +void +Manager::receive_debug_tracker(torrent::Bencode& bencode) { + std::stringstream filename; + filename << "./tracker_dump." << m_debugTracker++; + + std::fstream out(filename.str().c_str(), std::ios::out | std::ios::trunc); + + if (!out.good()) + return; + + out << bencode; +} + } diff --git a/src/core/manager.h b/src/core/manager.h index 6744c3dc..0e172450 100644 --- a/src/core/manager.h +++ b/src/core/manager.h @@ -8,6 +8,10 @@ #include "poll.h" #include "log.h" +namespace torrent { + class Bencode; +} + namespace core { class Manager { @@ -16,7 +20,7 @@ public: typedef sigc::slot1 SlotReady; typedef sigc::slot0 SlotFailed; - Manager() : m_portFirst(6890), m_portLast(6999) {} + Manager() : m_portFirst(6890), m_portLast(6999), m_debugTracker(-1) {} DownloadList& get_download_list() { return m_downloadList; } DownloadStore& get_download_store() { return m_downloadStore; } @@ -40,6 +44,8 @@ public: void set_port_range(int a, int b) { m_portFirst = a; m_portLast = b; } + void debug_tracker() { m_debugTracker = 0; } + private: void receive_http_done(CurlGet* http); void receive_http_failed(std::string msg); @@ -49,6 +55,8 @@ private: iterator create_final(std::istream* s); + void receive_debug_tracker(torrent::Bencode& bencode); + DownloadList m_downloadList; DownloadStore m_downloadStore; HashQueue m_hashQueue; @@ -60,6 +68,8 @@ private: std::string m_dns; int m_portFirst; int m_portLast; + + int m_debugTracker; }; } diff --git a/src/display/window_log.cc b/src/display/window_log.cc index 2030d80f..8d864f68 100644 --- a/src/display/window_log.cc +++ b/src/display/window_log.cc @@ -21,7 +21,7 @@ WindowLog::~WindowLog() { WindowLog::iterator WindowLog::find_older() { - return m_log->find_older(utils::Timer::cache() - 10*1000000); + return m_log->find_older(utils::Timer::cache() - 60*1000000); } void diff --git a/src/main.cc b/src/main.cc index 1f7f8f23..decd0564 100644 --- a/src/main.cc +++ b/src/main.cc @@ -81,6 +81,8 @@ parse_options(ui::Control* c, int argc, char** argv) { sigc::mem_fun(c->get_core(), &core::Manager::set_port_range))); optionParser.insert_option('s', sigc::mem_fun(c->get_core().get_download_store(), &core::DownloadStore::activate)); + optionParser.insert_flag('t', sigc::mem_fun(c->get_core(), &core::Manager::debug_tracker)); + return optionParser.process(argc, argv); } diff --git a/src/utils/directory.cc b/src/utils/directory.cc index eb5ca593..33f4d338 100644 --- a/src/utils/directory.cc +++ b/src/utils/directory.cc @@ -29,6 +29,7 @@ Directory::update() { Base::push_back(ent->d_name); } + closedir(d); Base::sort(std::less()); }