Skip to content

Commit

Permalink
Added 'd.tracker.send_scrape = <seconds_to_request>' command for send…
Browse files Browse the repository at this point in the history
…ing scrape requests to all trackers that support it.

Newly inserted downloads send scrape requests after 30 seconds.
  • Loading branch information
rakshasa committed Nov 7, 2011
1 parent f4c3758 commit 00a4235
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/command_download.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#include <torrent/rate.h>
#include <torrent/throttle.h>
#include <torrent/tracker.h>
#include <torrent/tracker_controller.h>
#include <torrent/tracker_list.h>
#include <torrent/connection_manager.h>
#include <torrent/data/download_data.h>
Expand Down Expand Up @@ -582,6 +583,7 @@ d_list_remove(core::Download* download, const torrent::Object& rawArgs, const ch
#define CMD2_BIND_FL std::bind(&core::Download::file_list, std::placeholders::_1)
#define CMD2_BIND_PL std::bind(&core::Download::c_peer_list, std::placeholders::_1)
#define CMD2_BIND_TL std::bind(&core::Download::tracker_list, std::placeholders::_1)
#define CMD2_BIND_TC std::bind(&core::Download::tracker_controller, std::placeholders::_1)

#define CMD2_BIND_INFO std::bind(&core::Download::info, std::placeholders::_1)
#define CMD2_BIND_DATA std::bind(&core::Download::data, std::placeholders::_1)
Expand Down Expand Up @@ -824,7 +826,9 @@ initialize_command_download() {
// TODO: Deprecate 'd.tracker_focus'.
CMD2_DL ("d.tracker_focus", std::bind(&core::Download::tracker_list_size, std::placeholders::_1));
CMD2_DL ("d.tracker_size", std::bind(&core::Download::tracker_list_size, std::placeholders::_1));

CMD2_DL_LIST ("d.tracker.insert", std::bind(&download_tracker_insert, std::placeholders::_1, std::placeholders::_2));
CMD2_DL_VALUE_V ("d.tracker.send_scrape", std::bind(&torrent::TrackerController::scrape_request, CMD2_BIND_TC, std::placeholders::_2));

CMD2_DL ("d.directory", CMD2_ON_FL(root_dir));
CMD2_DL_STRING_V("d.directory.set", std::bind(&apply_d_directory, std::placeholders::_1, std::placeholders::_2));
Expand Down
3 changes: 3 additions & 0 deletions src/core/download.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class Download {
typedef torrent::FileList file_list_type;
typedef torrent::PeerList peer_list_type;
typedef torrent::TrackerList tracker_list_type;
typedef torrent::TrackerController tracker_controller_type;
typedef torrent::ConnectionList connection_list_type;
typedef download_type::ConnectionType connection_type;

Expand Down Expand Up @@ -105,6 +106,8 @@ class Download {
tracker_list_type* tracker_list() { return m_download.tracker_list(); }
uint32_t tracker_list_size() const { return m_download.tracker_list()->size(); }

tracker_controller_type* tracker_controller() { return m_download.tracker_controller(); }

connection_list_type* connection_list() { return m_download.connection_list(); }
uint32_t connection_list_size() const;

Expand Down
3 changes: 2 additions & 1 deletion src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ main(int argc, char** argv) {
"method.insert = event.download.hash_removed,multi|rlookup|static\n"
"method.insert = event.download.hash_queued,multi|rlookup|static\n"

"method.set_key = event.download.inserted, 1_connect_logs, d.initialize_logs=\n"
"method.set_key = event.download.inserted, 1_connect_logs, ((d.initialize_logs))\n"
"method.set_key = event.download.inserted, 1_send_scrape, ((d.tracker.send_scrape,30))\n"
"method.set_key = event.download.inserted_new, 1_prepare, \"branch=d.state=,view.set_visible=started,view.set_visible=stopped ;d.save_full_session=\"\n"
"method.set_key = event.download.inserted_session, 1_prepare, \"branch=d.state=,view.set_visible=started,view.set_visible=stopped\"\n"

Expand Down

0 comments on commit 00a4235

Please sign in to comment.