mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-21 16:46:18 +00:00
Moved torrent::Tracker to torrent::tracker::Tracker.
This commit is contained in:
+2
-38
@@ -1,39 +1,3 @@
|
|||||||
// rTorrent - BitTorrent client
|
|
||||||
// Copyright (C) 2005-2011, Jari Sundell
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation; either version 2 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
//
|
|
||||||
// In addition, as a special exception, the copyright holders give
|
|
||||||
// permission to link the code of portions of this program with the
|
|
||||||
// OpenSSL library under certain conditions as described in each
|
|
||||||
// individual source file, and distribute linked combinations
|
|
||||||
// including the two.
|
|
||||||
//
|
|
||||||
// You must obey the GNU General Public License in all respects for
|
|
||||||
// all of the code used other than OpenSSL. If you modify file(s)
|
|
||||||
// with this exception, you may extend this exception to your version
|
|
||||||
// of the file(s), but you are not obligated to do so. If you do not
|
|
||||||
// wish to do so, delete this exception statement from your version.
|
|
||||||
// If you delete this exception statement from all source files in the
|
|
||||||
// program, then also delete it here.
|
|
||||||
//
|
|
||||||
// Contact: Jari Sundell <jaris@ifi.uio.no>
|
|
||||||
//
|
|
||||||
// Skomakerveien 33
|
|
||||||
// 3185 Skoppum, NORWAY
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
@@ -47,9 +11,9 @@
|
|||||||
#include <rak/regex.h>
|
#include <rak/regex.h>
|
||||||
#include <torrent/rate.h>
|
#include <torrent/rate.h>
|
||||||
#include <torrent/throttle.h>
|
#include <torrent/throttle.h>
|
||||||
#include <torrent/tracker.h>
|
|
||||||
#include <torrent/tracker_controller.h>
|
#include <torrent/tracker_controller.h>
|
||||||
#include <torrent/tracker_list.h>
|
#include <torrent/tracker_list.h>
|
||||||
|
#include <torrent/tracker/tracker.h>
|
||||||
#include <torrent/connection_manager.h>
|
#include <torrent/connection_manager.h>
|
||||||
#include <torrent/data/download_data.h>
|
#include <torrent/data/download_data.h>
|
||||||
#include <torrent/data/file.h>
|
#include <torrent/data/file.h>
|
||||||
@@ -435,7 +399,7 @@ t_multicall(core::Download* download, const torrent::Object::list_type& args) {
|
|||||||
|
|
||||||
for (torrent::Object::list_const_iterator cItr = ++args.begin(); cItr != args.end(); cItr++) {
|
for (torrent::Object::list_const_iterator cItr = ++args.begin(); cItr != args.end(); cItr++) {
|
||||||
const std::string& cmd = cItr->as_string();
|
const std::string& cmd = cItr->as_string();
|
||||||
torrent::Tracker* t = download->tracker_list()->at(itr);
|
auto t = download->tracker_list()->at(itr);
|
||||||
|
|
||||||
row.push_back(rpc::parse_command(rpc::make_target(t), cmd.c_str(), cmd.c_str() + cmd.size()).first);
|
row.push_back(rpc::parse_command(rpc::make_target(t), cmd.c_str(), cmd.c_str() + cmd.size()).first);
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-39
@@ -1,39 +1,3 @@
|
|||||||
// rTorrent - BitTorrent client
|
|
||||||
// Copyright (C) 2005-2011, Jari Sundell
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation; either version 2 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
//
|
|
||||||
// In addition, as a special exception, the copyright holders give
|
|
||||||
// permission to link the code of portions of this program with the
|
|
||||||
// OpenSSL library under certain conditions as described in each
|
|
||||||
// individual source file, and distribute linked combinations
|
|
||||||
// including the two.
|
|
||||||
//
|
|
||||||
// You must obey the GNU General Public License in all respects for
|
|
||||||
// all of the code used other than OpenSSL. If you modify file(s)
|
|
||||||
// with this exception, you may extend this exception to your version
|
|
||||||
// of the file(s), but you are not obligated to do so. If you do not
|
|
||||||
// wish to do so, delete this exception statement from your version.
|
|
||||||
// If you delete this exception statement from all source files in the
|
|
||||||
// program, then also delete it here.
|
|
||||||
//
|
|
||||||
// Contact: Jari Sundell <jaris@ifi.uio.no>
|
|
||||||
//
|
|
||||||
// Skomakerveien 33
|
|
||||||
// 3185 Skoppum, NORWAY
|
|
||||||
|
|
||||||
#ifndef RTORRENT_UTILS_COMMAND_HELPERS_H
|
#ifndef RTORRENT_UTILS_COMMAND_HELPERS_H
|
||||||
#define RTORRENT_UTILS_COMMAND_HELPERS_H
|
#define RTORRENT_UTILS_COMMAND_HELPERS_H
|
||||||
|
|
||||||
@@ -92,9 +56,9 @@ void initialize_commands();
|
|||||||
#define CMD2_PEER_V(key, slot) CMD2_A_FUNCTION(key, command_base_call<torrent::Peer*>, object_convert_void(slot), "i:", "")
|
#define CMD2_PEER_V(key, slot) CMD2_A_FUNCTION(key, command_base_call<torrent::Peer*>, object_convert_void(slot), "i:", "")
|
||||||
#define CMD2_PEER_VALUE_V(key, slot) CMD2_A_FUNCTION(key, command_base_call_value<torrent::Peer*>, object_convert_void(slot), "i:i", "")
|
#define CMD2_PEER_VALUE_V(key, slot) CMD2_A_FUNCTION(key, command_base_call_value<torrent::Peer*>, object_convert_void(slot), "i:i", "")
|
||||||
|
|
||||||
#define CMD2_TRACKER(key, slot) CMD2_A_FUNCTION(key, command_base_call<torrent::Tracker*>, slot, "i:", "")
|
#define CMD2_TRACKER(key, slot) CMD2_A_FUNCTION(key, command_base_call<torrent::tracker::Tracker*>, slot, "i:", "")
|
||||||
#define CMD2_TRACKER_V(key, slot) CMD2_A_FUNCTION(key, command_base_call<torrent::Tracker*>, object_convert_void(slot), "i:", "")
|
#define CMD2_TRACKER_V(key, slot) CMD2_A_FUNCTION(key, command_base_call<torrent::tracker::Tracker*>, object_convert_void(slot), "i:", "")
|
||||||
#define CMD2_TRACKER_VALUE_V(key, slot) CMD2_A_FUNCTION(key, command_base_call_value<torrent::Tracker*>, object_convert_void(slot), "i:i", "")
|
#define CMD2_TRACKER_VALUE_V(key, slot) CMD2_A_FUNCTION(key, command_base_call_value<torrent::tracker::Tracker*>, object_convert_void(slot), "i:i", "")
|
||||||
|
|
||||||
#define CMD2_VAR_BOOL(key, value) \
|
#define CMD2_VAR_BOOL(key, value) \
|
||||||
control->object_storage()->insert_c_str(key, int64_t(value), rpc::object_storage::flag_bool_type); \
|
control->object_storage()->insert_c_str(key, int64_t(value), rpc::object_storage::flag_bool_type); \
|
||||||
|
|||||||
+2
-38
@@ -1,39 +1,3 @@
|
|||||||
// rTorrent - BitTorrent client
|
|
||||||
// Copyright (C) 2005-2011, Jari Sundell
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation; either version 2 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
//
|
|
||||||
// In addition, as a special exception, the copyright holders give
|
|
||||||
// permission to link the code of portions of this program with the
|
|
||||||
// OpenSSL library under certain conditions as described in each
|
|
||||||
// individual source file, and distribute linked combinations
|
|
||||||
// including the two.
|
|
||||||
//
|
|
||||||
// You must obey the GNU General Public License in all respects for
|
|
||||||
// all of the code used other than OpenSSL. If you modify file(s)
|
|
||||||
// with this exception, you may extend this exception to your version
|
|
||||||
// of the file(s), but you are not obligated to do so. If you do not
|
|
||||||
// wish to do so, delete this exception statement from your version.
|
|
||||||
// If you delete this exception statement from all source files in the
|
|
||||||
// program, then also delete it here.
|
|
||||||
//
|
|
||||||
// Contact: Jari Sundell <jaris@ifi.uio.no>
|
|
||||||
//
|
|
||||||
// Skomakerveien 33
|
|
||||||
// 3185 Skoppum, NORWAY
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
@@ -42,8 +6,8 @@
|
|||||||
#include <rak/address_info.h>
|
#include <rak/address_info.h>
|
||||||
#include <rak/path.h>
|
#include <rak/path.h>
|
||||||
#include <torrent/connection_manager.h>
|
#include <torrent/connection_manager.h>
|
||||||
#include <torrent/tracker.h>
|
|
||||||
#include <torrent/tracker_list.h>
|
#include <torrent/tracker_list.h>
|
||||||
|
#include <torrent/tracker/tracker.h>
|
||||||
#include <torrent/torrent.h>
|
#include <torrent/torrent.h>
|
||||||
#include <torrent/rate.h>
|
#include <torrent/rate.h>
|
||||||
#include <torrent/data/file_manager.h>
|
#include <torrent/data/file_manager.h>
|
||||||
@@ -103,7 +67,7 @@ rpc_find_file(core::Download* download, uint32_t index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ergh... time to update the Tracker API to allow proper ptrs.
|
// Ergh... time to update the Tracker API to allow proper ptrs.
|
||||||
torrent::Tracker*
|
torrent::tracker::Tracker*
|
||||||
rpc_find_tracker(core::Download* download, uint32_t index) {
|
rpc_find_tracker(core::Download* download, uint32_t index) {
|
||||||
if (index >= download->tracker_list()->size())
|
if (index >= download->tracker_list()->size())
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
+34
-34
@@ -4,7 +4,7 @@
|
|||||||
#include <rak/address_info.h>
|
#include <rak/address_info.h>
|
||||||
#include <rak/error_number.h>
|
#include <rak/error_number.h>
|
||||||
#include <torrent/dht_manager.h>
|
#include <torrent/dht_manager.h>
|
||||||
#include <torrent/tracker.h>
|
#include <torrent/tracker/tracker.h>
|
||||||
#include <torrent/utils/log.h>
|
#include <torrent/utils/log.h>
|
||||||
|
|
||||||
#include "core/download.h"
|
#include "core/download.h"
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
#include "core/dht_manager.h"
|
#include "core/dht_manager.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
tracker_set_enabled(torrent::Tracker* tracker, bool state) {
|
tracker_set_enabled(torrent::tracker::Tracker* tracker, bool state) {
|
||||||
if (state)
|
if (state)
|
||||||
tracker->enable();
|
tracker->enable();
|
||||||
else
|
else
|
||||||
@@ -63,7 +63,7 @@ apply_dht_add_node(const std::string& arg) {
|
|||||||
torrent::Object
|
torrent::Object
|
||||||
apply_enable_trackers(int64_t arg) {
|
apply_enable_trackers(int64_t arg) {
|
||||||
for (core::Manager::DListItr itr = control->core()->download_list()->begin(), last = control->core()->download_list()->end(); itr != last; ++itr) {
|
for (core::Manager::DListItr itr = control->core()->download_list()->begin(), last = control->core()->download_list()->end(); itr != last; ++itr) {
|
||||||
std::for_each((*itr)->tracker_list()->begin(), (*itr)->tracker_list()->end(), std::mem_fn(arg ? &torrent::Tracker::enable : &torrent::Tracker::disable));
|
std::for_each((*itr)->tracker_list()->begin(), (*itr)->tracker_list()->end(), std::mem_fn(arg ? &torrent::tracker::Tracker::enable : &torrent::tracker::Tracker::disable));
|
||||||
|
|
||||||
if (arg && !rpc::call_command_value("trackers.use_udp"))
|
if (arg && !rpc::call_command_value("trackers.use_udp"))
|
||||||
(*itr)->enable_udp_trackers(false);
|
(*itr)->enable_udp_trackers(false);
|
||||||
@@ -74,50 +74,50 @@ apply_enable_trackers(int64_t arg) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
initialize_command_tracker() {
|
initialize_command_tracker() {
|
||||||
CMD2_TRACKER ("t.is_busy", std::bind(&torrent::Tracker::is_busy, std::placeholders::_1));
|
CMD2_TRACKER ("t.is_busy", std::bind(&torrent::tracker::Tracker::is_busy, std::placeholders::_1));
|
||||||
CMD2_TRACKER ("t.is_enabled", std::bind(&torrent::Tracker::is_enabled, std::placeholders::_1));
|
CMD2_TRACKER ("t.is_enabled", std::bind(&torrent::tracker::Tracker::is_enabled, std::placeholders::_1));
|
||||||
CMD2_TRACKER ("t.is_extra_tracker", std::bind(&torrent::Tracker::is_extra_tracker, std::placeholders::_1));
|
CMD2_TRACKER ("t.is_extra_tracker", std::bind(&torrent::tracker::Tracker::is_extra_tracker, std::placeholders::_1));
|
||||||
CMD2_TRACKER ("t.is_open", std::bind(&torrent::Tracker::is_busy, std::placeholders::_1));
|
CMD2_TRACKER ("t.is_open", std::bind(&torrent::tracker::Tracker::is_busy, std::placeholders::_1));
|
||||||
CMD2_TRACKER ("t.is_scrapable", std::bind(&torrent::Tracker::is_scrapable, std::placeholders::_1));
|
CMD2_TRACKER ("t.is_scrapable", std::bind(&torrent::tracker::Tracker::is_scrapable, std::placeholders::_1));
|
||||||
CMD2_TRACKER ("t.is_usable", std::bind(&torrent::Tracker::is_usable, std::placeholders::_1));
|
CMD2_TRACKER ("t.is_usable", std::bind(&torrent::tracker::Tracker::is_usable, std::placeholders::_1));
|
||||||
|
|
||||||
// TODO: Deprecate.
|
// TODO: Deprecate.
|
||||||
CMD2_TRACKER ("t.can_scrape", std::bind(&torrent::Tracker::is_scrapable, std::placeholders::_1));
|
CMD2_TRACKER ("t.can_scrape", std::bind(&torrent::tracker::Tracker::is_scrapable, std::placeholders::_1));
|
||||||
|
|
||||||
CMD2_TRACKER_V ("t.enable", std::bind(&torrent::Tracker::enable, std::placeholders::_1));
|
CMD2_TRACKER_V ("t.enable", std::bind(&torrent::tracker::Tracker::enable, std::placeholders::_1));
|
||||||
CMD2_TRACKER_V ("t.disable", std::bind(&torrent::Tracker::disable, std::placeholders::_1));
|
CMD2_TRACKER_V ("t.disable", std::bind(&torrent::tracker::Tracker::disable, std::placeholders::_1));
|
||||||
|
|
||||||
CMD2_TRACKER_VALUE_V("t.is_enabled.set", std::bind(&tracker_set_enabled, std::placeholders::_1, std::placeholders::_2));
|
CMD2_TRACKER_VALUE_V("t.is_enabled.set", std::bind(&tracker_set_enabled, std::placeholders::_1, std::placeholders::_2));
|
||||||
|
|
||||||
CMD2_TRACKER ("t.url", std::bind(&torrent::Tracker::url, std::placeholders::_1));
|
CMD2_TRACKER ("t.url", std::bind(&torrent::tracker::Tracker::url, std::placeholders::_1));
|
||||||
CMD2_TRACKER ("t.group", std::bind(&torrent::Tracker::group, std::placeholders::_1));
|
CMD2_TRACKER ("t.group", std::bind(&torrent::tracker::Tracker::group, std::placeholders::_1));
|
||||||
CMD2_TRACKER ("t.type", std::bind(&torrent::Tracker::type, std::placeholders::_1));
|
CMD2_TRACKER ("t.type", std::bind(&torrent::tracker::Tracker::type, std::placeholders::_1));
|
||||||
CMD2_TRACKER ("t.id", std::bind(&torrent::Tracker::tracker_id, std::placeholders::_1));
|
CMD2_TRACKER ("t.id", std::bind(&torrent::tracker::Tracker::tracker_id, std::placeholders::_1));
|
||||||
|
|
||||||
CMD2_TRACKER ("t.latest_event", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().latest_event(); });
|
CMD2_TRACKER ("t.latest_event", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().latest_event(); });
|
||||||
CMD2_TRACKER ("t.latest_new_peers", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().latest_new_peers(); });
|
CMD2_TRACKER ("t.latest_new_peers", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().latest_new_peers(); });
|
||||||
CMD2_TRACKER ("t.latest_sum_peers", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().latest_sum_peers(); });
|
CMD2_TRACKER ("t.latest_sum_peers", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().latest_sum_peers(); });
|
||||||
|
|
||||||
CMD2_TRACKER ("t.normal_interval", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().normal_interval(); });
|
CMD2_TRACKER ("t.normal_interval", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().normal_interval(); });
|
||||||
CMD2_TRACKER ("t.min_interval", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().min_interval(); });
|
CMD2_TRACKER ("t.min_interval", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().min_interval(); });
|
||||||
|
|
||||||
CMD2_TRACKER ("t.activity_time_next", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().activity_time_next(); });
|
CMD2_TRACKER ("t.activity_time_next", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().activity_time_next(); });
|
||||||
CMD2_TRACKER ("t.activity_time_last", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().activity_time_last(); });
|
CMD2_TRACKER ("t.activity_time_last", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().activity_time_last(); });
|
||||||
|
|
||||||
CMD2_TRACKER ("t.success_time_next", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().success_time_next(); });
|
CMD2_TRACKER ("t.success_time_next", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().success_time_next(); });
|
||||||
CMD2_TRACKER ("t.success_time_last", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().success_time_last(); });
|
CMD2_TRACKER ("t.success_time_last", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().success_time_last(); });
|
||||||
CMD2_TRACKER ("t.success_counter", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().success_counter(); });
|
CMD2_TRACKER ("t.success_counter", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().success_counter(); });
|
||||||
|
|
||||||
CMD2_TRACKER ("t.failed_time_next", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().failed_time_next(); });
|
CMD2_TRACKER ("t.failed_time_next", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().failed_time_next(); });
|
||||||
CMD2_TRACKER ("t.failed_time_last", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().failed_time_last(); });
|
CMD2_TRACKER ("t.failed_time_last", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().failed_time_last(); });
|
||||||
CMD2_TRACKER ("t.failed_counter", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().failed_counter(); });
|
CMD2_TRACKER ("t.failed_counter", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().failed_counter(); });
|
||||||
|
|
||||||
CMD2_TRACKER ("t.scrape_time_last", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().scrape_time_last(); });
|
CMD2_TRACKER ("t.scrape_time_last", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().scrape_time_last(); });
|
||||||
CMD2_TRACKER ("t.scrape_counter", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().scrape_counter(); });
|
CMD2_TRACKER ("t.scrape_counter", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().scrape_counter(); });
|
||||||
|
|
||||||
CMD2_TRACKER ("t.scrape_complete", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().scrape_complete(); });
|
CMD2_TRACKER ("t.scrape_complete", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().scrape_complete(); });
|
||||||
CMD2_TRACKER ("t.scrape_incomplete", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().scrape_incomplete(); });
|
CMD2_TRACKER ("t.scrape_incomplete", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().scrape_incomplete(); });
|
||||||
CMD2_TRACKER ("t.scrape_downloaded", [](torrent::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().scrape_downloaded(); });
|
CMD2_TRACKER ("t.scrape_downloaded", [](torrent::tracker::Tracker* tracker, [[maybe_unused]] auto o) -> auto { return tracker->state().scrape_downloaded(); });
|
||||||
|
|
||||||
CMD2_ANY_VALUE ("trackers.enable", std::bind(&apply_enable_trackers, int64_t(1)));
|
CMD2_ANY_VALUE ("trackers.enable", std::bind(&apply_enable_trackers, int64_t(1)));
|
||||||
CMD2_ANY_VALUE ("trackers.disable", std::bind(&apply_enable_trackers, int64_t(0)));
|
CMD2_ANY_VALUE ("trackers.disable", std::bind(&apply_enable_trackers, int64_t(0)));
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
#include <torrent/exceptions.h>
|
#include <torrent/exceptions.h>
|
||||||
#include <torrent/rate.h>
|
#include <torrent/rate.h>
|
||||||
#include <torrent/torrent.h>
|
#include <torrent/torrent.h>
|
||||||
#include <torrent/tracker.h>
|
|
||||||
#include <torrent/tracker_list.h>
|
#include <torrent/tracker_list.h>
|
||||||
|
#include <torrent/tracker/tracker.h>
|
||||||
#include <torrent/data/file_list.h>
|
#include <torrent/data/file_list.h>
|
||||||
|
|
||||||
#include "rpc/parse_commands.h"
|
#include "rpc/parse_commands.h"
|
||||||
|
|||||||
+1
-5
@@ -1,6 +1,7 @@
|
|||||||
#ifndef RTORRENT_CORE_DOWNLOAD_H
|
#ifndef RTORRENT_CORE_DOWNLOAD_H
|
||||||
#define RTORRENT_CORE_DOWNLOAD_H
|
#define RTORRENT_CORE_DOWNLOAD_H
|
||||||
|
|
||||||
|
#include <torrent/common.h>
|
||||||
#include <torrent/download.h>
|
#include <torrent/download.h>
|
||||||
#include <torrent/download_info.h>
|
#include <torrent/download_info.h>
|
||||||
#include <torrent/hash_string.h>
|
#include <torrent/hash_string.h>
|
||||||
@@ -10,11 +11,6 @@
|
|||||||
|
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
|
||||||
namespace torrent {
|
|
||||||
class PeerList;
|
|
||||||
class TrackerList;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace core {
|
namespace core {
|
||||||
|
|
||||||
class Download {
|
class Download {
|
||||||
|
|||||||
+4
-41
@@ -1,39 +1,3 @@
|
|||||||
// rTorrent - BitTorrent client
|
|
||||||
// Copyright (C) 2005-2011, Jari Sundell
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation; either version 2 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
//
|
|
||||||
// In addition, as a special exception, the copyright holders give
|
|
||||||
// permission to link the code of portions of this program with the
|
|
||||||
// OpenSSL library under certain conditions as described in each
|
|
||||||
// individual source file, and distribute linked combinations
|
|
||||||
// including the two.
|
|
||||||
//
|
|
||||||
// You must obey the GNU General Public License in all respects for
|
|
||||||
// all of the code used other than OpenSSL. If you modify file(s)
|
|
||||||
// with this exception, you may extend this exception to your version
|
|
||||||
// of the file(s), but you are not obligated to do so. If you do not
|
|
||||||
// wish to do so, delete this exception statement from your version.
|
|
||||||
// If you delete this exception statement from all source files in the
|
|
||||||
// program, then also delete it here.
|
|
||||||
//
|
|
||||||
// Contact: Jari Sundell <jaris@ifi.uio.no>
|
|
||||||
//
|
|
||||||
// Skomakerveien 33
|
|
||||||
// 3185 Skoppum, NORWAY
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@@ -47,8 +11,8 @@
|
|||||||
#include <torrent/rate.h>
|
#include <torrent/rate.h>
|
||||||
#include <torrent/throttle.h>
|
#include <torrent/throttle.h>
|
||||||
#include <torrent/torrent.h>
|
#include <torrent/torrent.h>
|
||||||
#include <torrent/tracker.h>
|
|
||||||
#include <torrent/tracker_list.h>
|
#include <torrent/tracker_list.h>
|
||||||
|
#include <torrent/tracker/tracker.h>
|
||||||
#include <torrent/data/file_list.h>
|
#include <torrent/data/file_list.h>
|
||||||
#include <torrent/data/file_manager.h>
|
#include <torrent/data/file_manager.h>
|
||||||
#include <torrent/download/resource_manager.h>
|
#include <torrent/download/resource_manager.h>
|
||||||
@@ -199,12 +163,11 @@ print_download_status(char* first, char* last, core::Download* d) {
|
|||||||
} else if (d->tracker_list()->has_active_not_scrape()) {
|
} else if (d->tracker_list()->has_active_not_scrape()) {
|
||||||
torrent::TrackerList::iterator itr =
|
torrent::TrackerList::iterator itr =
|
||||||
std::find_if(d->tracker_list()->begin(), d->tracker_list()->end(),
|
std::find_if(d->tracker_list()->begin(), d->tracker_list()->end(),
|
||||||
std::mem_fn(&torrent::Tracker::is_busy_not_scrape));
|
std::mem_fn(&torrent::tracker::Tracker::is_busy_not_scrape));
|
||||||
char status[128];
|
auto status = (*itr)->status();
|
||||||
|
|
||||||
(*itr)->get_status(status, sizeof(status));
|
|
||||||
first = print_buffer(first, last, "Tracker[%i:%i]: Connecting to %s %s",
|
first = print_buffer(first, last, "Tracker[%i:%i]: Connecting to %s %s",
|
||||||
(*itr)->group(), std::distance(d->tracker_list()->begin(), itr), (*itr)->url().c_str(), status);
|
(*itr)->group(), std::distance(d->tracker_list()->begin(), itr), (*itr)->url().c_str(), status.c_str());
|
||||||
|
|
||||||
} else if (!d->message().empty()) {
|
} else if (!d->message().empty()) {
|
||||||
first = print_buffer(first, last, "%s", d->message().c_str());
|
first = print_buffer(first, last, "%s", d->message().c_str());
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
#include <rak/algorithm.h>
|
#include <rak/algorithm.h>
|
||||||
#include <rak/string_manip.h>
|
#include <rak/string_manip.h>
|
||||||
#include <torrent/exceptions.h>
|
#include <torrent/exceptions.h>
|
||||||
#include <torrent/tracker.h>
|
|
||||||
#include <torrent/tracker_list.h>
|
#include <torrent/tracker_list.h>
|
||||||
#include <torrent/tracker_controller.h>
|
#include <torrent/tracker_controller.h>
|
||||||
|
#include <torrent/tracker/tracker.h>
|
||||||
|
|
||||||
#include "core/download.h"
|
#include "core/download.h"
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ WindowTrackerList::redraw() {
|
|||||||
unsigned int group = tl->at(range.first)->group();
|
unsigned int group = tl->at(range.first)->group();
|
||||||
|
|
||||||
while (range.first != range.second) {
|
while (range.first != range.second) {
|
||||||
torrent::Tracker* tracker = tl->at(range.first);
|
auto tracker = tl->at(range.first);
|
||||||
|
|
||||||
if (tracker->group() == group)
|
if (tracker->group() == group)
|
||||||
m_canvas->print(0, pos, "%2i:", group++);
|
m_canvas->print(0, pos, "%2i:", group++);
|
||||||
|
|||||||
+1
-37
@@ -1,39 +1,3 @@
|
|||||||
// rTorrent - BitTorrent client
|
|
||||||
// Copyright (C) 2005-2011, Jari Sundell
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation; either version 2 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
//
|
|
||||||
// In addition, as a special exception, the copyright holders give
|
|
||||||
// permission to link the code of portions of this program with the
|
|
||||||
// OpenSSL library under certain conditions as described in each
|
|
||||||
// individual source file, and distribute linked combinations
|
|
||||||
// including the two.
|
|
||||||
//
|
|
||||||
// You must obey the GNU General Public License in all respects for
|
|
||||||
// all of the code used other than OpenSSL. If you modify file(s)
|
|
||||||
// with this exception, you may extend this exception to your version
|
|
||||||
// of the file(s), but you are not obligated to do so. If you do not
|
|
||||||
// wish to do so, delete this exception statement from your version.
|
|
||||||
// If you delete this exception statement from all source files in the
|
|
||||||
// program, then also delete it here.
|
|
||||||
//
|
|
||||||
// Contact: Jari Sundell <jaris@ifi.uio.no>
|
|
||||||
//
|
|
||||||
// Skomakerveien 33
|
|
||||||
// 3185 Skoppum, NORWAY
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "core/download.h"
|
#include "core/download.h"
|
||||||
@@ -45,7 +9,7 @@
|
|||||||
template const torrent::Object func_name<target_type>(command_base* rawCommand, target_type target, const torrent::Object& args); \
|
template const torrent::Object func_name<target_type>(command_base* rawCommand, target_type target, const torrent::Object& args); \
|
||||||
template const torrent::Object func_name<core::Download*>(command_base* rawCommand, target_type target, const torrent::Object& args); \
|
template const torrent::Object func_name<core::Download*>(command_base* rawCommand, target_type target, const torrent::Object& args); \
|
||||||
template const torrent::Object func_name<torrent::Peer*>(command_base* rawCommand, target_type target, const torrent::Object& args); \
|
template const torrent::Object func_name<torrent::Peer*>(command_base* rawCommand, target_type target, const torrent::Object& args); \
|
||||||
template const torrent::Object func_name<torrent::Tracker*>(command_base* rawCommand, target_type target, const torrent::Object& args); \
|
template const torrent::Object func_name<torrent::tracker::Tracker*>(command_base* rawCommand, target_type target, const torrent::Object& args); \
|
||||||
template const torrent::Object func_name<torrent::File*>(command_base* rawCommand, target_type target, const torrent::Object& args); \
|
template const torrent::Object func_name<torrent::File*>(command_base* rawCommand, target_type target, const torrent::Object& args); \
|
||||||
template const torrent::Object func_name<torrent::FileListIterator*>(command_base* rawCommand, target_type target, const torrent::Object& args);
|
template const torrent::Object func_name<torrent::FileListIterator*>(command_base* rawCommand, target_type target, const torrent::Object& args);
|
||||||
|
|
||||||
|
|||||||
+7
-13
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
#include <torrent/common.h>
|
||||||
#include <torrent/object.h>
|
#include <torrent/object.h>
|
||||||
#include <torrent/data/file_list_iterator.h>
|
#include <torrent/data/file_list_iterator.h>
|
||||||
|
|
||||||
@@ -11,13 +12,6 @@ namespace core {
|
|||||||
class Download;
|
class Download;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace torrent {
|
|
||||||
class File;
|
|
||||||
class FileListIterator;
|
|
||||||
class Peer;
|
|
||||||
class Tracker;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace rpc {
|
namespace rpc {
|
||||||
|
|
||||||
template <typename Target>
|
template <typename Target>
|
||||||
@@ -89,7 +83,7 @@ public:
|
|||||||
typedef const torrent::Object (*file_slot) (command_base*, torrent::File*, const torrent::Object&);
|
typedef const torrent::Object (*file_slot) (command_base*, torrent::File*, const torrent::Object&);
|
||||||
typedef const torrent::Object (*file_itr_slot) (command_base*, torrent::FileListIterator*, const torrent::Object&);
|
typedef const torrent::Object (*file_itr_slot) (command_base*, torrent::FileListIterator*, const torrent::Object&);
|
||||||
typedef const torrent::Object (*peer_slot) (command_base*, torrent::Peer*, const torrent::Object&);
|
typedef const torrent::Object (*peer_slot) (command_base*, torrent::Peer*, const torrent::Object&);
|
||||||
typedef const torrent::Object (*tracker_slot) (command_base*, torrent::Tracker*, const torrent::Object&);
|
typedef const torrent::Object (*tracker_slot) (command_base*, torrent::tracker::Tracker*, const torrent::Object&);
|
||||||
|
|
||||||
typedef const torrent::Object (*download_pair_slot) (command_base*, core::Download*, core::Download*, const torrent::Object&);
|
typedef const torrent::Object (*download_pair_slot) (command_base*, core::Download*, core::Download*, const torrent::Object&);
|
||||||
|
|
||||||
@@ -138,10 +132,10 @@ public:
|
|||||||
static void pop_stack(stack_type* stack, torrent::Object* last_stack);
|
static void pop_stack(stack_type* stack, torrent::Object* last_stack);
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void set_function(T s, int value = command_base_is_valid<T>::value) { _pod<T>() = s; }
|
void set_function(T s, [[maybe_unused]] int value = command_base_is_valid<T>::value) { _pod<T>() = s; }
|
||||||
|
|
||||||
template <command_base_call_type T>
|
template <command_base_call_type T>
|
||||||
void set_function_2(typename command_base_is_type<T>::type s, int value = command_base_is_valid<typename command_base_is_type<T>::type>::value) {
|
void set_function_2(typename command_base_is_type<T>::type s, [[maybe_unused]] int value = command_base_is_valid<typename command_base_is_type<T>::type>::value) {
|
||||||
_pod<typename command_base_is_type<T>::type>() = s;
|
_pod<typename command_base_is_type<T>::type>() = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,7 +184,7 @@ is_target_compatible(const target_type& target) { return target.first == target_
|
|||||||
inline bool is_target_pair(const target_type& target) { return target.first >= command_base::target_download_pair; }
|
inline bool is_target_pair(const target_type& target) { return target.first >= command_base::target_download_pair; }
|
||||||
|
|
||||||
template <typename T> inline T
|
template <typename T> inline T
|
||||||
get_target_cast(target_type target, int type = target_type_id<T>::value) { return (T)target.second; }
|
get_target_cast(target_type target, [[maybe_unused]] int type = target_type_id<T>::value) { return (T)target.second; }
|
||||||
|
|
||||||
inline target_type get_target_left(const target_type& target) { return target_type(target.first - 5, target.second); }
|
inline target_type get_target_left(const target_type& target) { return target_type(target.first - 5, target.second); }
|
||||||
inline target_type get_target_right(const target_type& target) { return target_type(target.first - 5, target.third); }
|
inline target_type get_target_right(const target_type& target) { return target_type(target.first - 5, target.third); }
|
||||||
@@ -213,7 +207,7 @@ command_base::_call(command_base* cmd, target_type target, Args args) {
|
|||||||
template <> struct command_base_is_valid<func_type<target_type>::type> { static const int value = 1; }; \
|
template <> struct command_base_is_valid<func_type<target_type>::type> { static const int value = 1; }; \
|
||||||
template <> struct command_base_is_valid<func_type<core::Download*>::type> { static const int value = 1; }; \
|
template <> struct command_base_is_valid<func_type<core::Download*>::type> { static const int value = 1; }; \
|
||||||
template <> struct command_base_is_valid<func_type<torrent::Peer*>::type> { static const int value = 1; }; \
|
template <> struct command_base_is_valid<func_type<torrent::Peer*>::type> { static const int value = 1; }; \
|
||||||
template <> struct command_base_is_valid<func_type<torrent::Tracker*>::type> { static const int value = 1; }; \
|
template <> struct command_base_is_valid<func_type<torrent::tracker::Tracker*>::type> { static const int value = 1; }; \
|
||||||
template <> struct command_base_is_valid<func_type<torrent::File*>::type> { static const int value = 1; }; \
|
template <> struct command_base_is_valid<func_type<torrent::File*>::type> { static const int value = 1; }; \
|
||||||
template <> struct command_base_is_valid<func_type<torrent::FileListIterator*>::type> { static const int value = 1; };
|
template <> struct command_base_is_valid<func_type<torrent::FileListIterator*>::type> { static const int value = 1; };
|
||||||
|
|
||||||
@@ -230,7 +224,7 @@ COMMAND_BASE_TEMPLATE_TYPE(command_list_function, torrent::Object (T, const to
|
|||||||
template <> struct command_base_is_type<func_name<target_type> > { static const int value = 1; typedef func_type<target_type>::type type; }; \
|
template <> struct command_base_is_type<func_name<target_type> > { static const int value = 1; typedef func_type<target_type>::type type; }; \
|
||||||
template <> struct command_base_is_type<func_name<core::Download*> > { static const int value = 1; typedef func_type<core::Download*>::type type; }; \
|
template <> struct command_base_is_type<func_name<core::Download*> > { static const int value = 1; typedef func_type<core::Download*>::type type; }; \
|
||||||
template <> struct command_base_is_type<func_name<torrent::Peer*> > { static const int value = 1; typedef func_type<torrent::Peer*>::type type; }; \
|
template <> struct command_base_is_type<func_name<torrent::Peer*> > { static const int value = 1; typedef func_type<torrent::Peer*>::type type; }; \
|
||||||
template <> struct command_base_is_type<func_name<torrent::Tracker*> > { static const int value = 1; typedef func_type<torrent::Tracker*>::type type; }; \
|
template <> struct command_base_is_type<func_name<torrent::tracker::Tracker*> > { static const int value = 1; typedef func_type<torrent::tracker::Tracker*>::type type; }; \
|
||||||
template <> struct command_base_is_type<func_name<torrent::File*> > { static const int value = 1; typedef func_type<torrent::File*>::type type; }; \
|
template <> struct command_base_is_type<func_name<torrent::File*> > { static const int value = 1; typedef func_type<torrent::File*>::type type; }; \
|
||||||
template <> struct command_base_is_type<func_name<torrent::FileListIterator*> > { static const int value = 1; typedef func_type<torrent::FileListIterator*>::type type; };
|
template <> struct command_base_is_type<func_name<torrent::FileListIterator*> > { static const int value = 1; typedef func_type<torrent::FileListIterator*>::type type; };
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ template <> struct target_type_id<> { static const in
|
|||||||
template <> struct target_type_id<target_type> { static const int value = command_base::target_any; static const int proper_type = 1; };
|
template <> struct target_type_id<target_type> { static const int value = command_base::target_any; static const int proper_type = 1; };
|
||||||
template <> struct target_type_id<core::Download*> { static const int value = command_base::target_download; static const int proper_type = 1; };
|
template <> struct target_type_id<core::Download*> { static const int value = command_base::target_download; static const int proper_type = 1; };
|
||||||
template <> struct target_type_id<torrent::Peer*> { static const int value = command_base::target_peer; static const int proper_type = 1; };
|
template <> struct target_type_id<torrent::Peer*> { static const int value = command_base::target_peer; static const int proper_type = 1; };
|
||||||
template <> struct target_type_id<torrent::Tracker*> { static const int value = command_base::target_tracker; static const int proper_type = 1; };
|
template <> struct target_type_id<torrent::tracker::Tracker*> { static const int value = command_base::target_tracker; static const int proper_type = 1; };
|
||||||
template <> struct target_type_id<torrent::File*> { static const int value = command_base::target_file; static const int proper_type = 1; };
|
template <> struct target_type_id<torrent::File*> { static const int value = command_base::target_file; static const int proper_type = 1; };
|
||||||
template <> struct target_type_id<torrent::FileListIterator*> { static const int value = command_base::target_file_itr; static const int proper_type = 1; };
|
template <> struct target_type_id<torrent::FileListIterator*> { static const int value = command_base::target_file_itr; static const int proper_type = 1; };
|
||||||
|
|
||||||
|
|||||||
+1
-37
@@ -1,39 +1,3 @@
|
|||||||
// rTorrent - BitTorrent client
|
|
||||||
// Copyright (C) 2005-2011, Jari Sundell
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation; either version 2 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
//
|
|
||||||
// In addition, as a special exception, the copyright holders give
|
|
||||||
// permission to link the code of portions of this program with the
|
|
||||||
// OpenSSL library under certain conditions as described in each
|
|
||||||
// individual source file, and distribute linked combinations
|
|
||||||
// including the two.
|
|
||||||
//
|
|
||||||
// You must obey the GNU General Public License in all respects for
|
|
||||||
// all of the code used other than OpenSSL. If you modify file(s)
|
|
||||||
// with this exception, you may extend this exception to your version
|
|
||||||
// of the file(s), but you are not obligated to do so. If you do not
|
|
||||||
// wish to do so, delete this exception statement from your version.
|
|
||||||
// If you delete this exception statement from all source files in the
|
|
||||||
// program, then also delete it here.
|
|
||||||
//
|
|
||||||
// Contact: Jari Sundell <jaris@ifi.uio.no>
|
|
||||||
//
|
|
||||||
// Skomakerveien 33
|
|
||||||
// 3185 Skoppum, NORWAY
|
|
||||||
|
|
||||||
#ifndef RTORRENT_RPC_COMMAND_MAP_H
|
#ifndef RTORRENT_RPC_COMMAND_MAP_H
|
||||||
#define RTORRENT_RPC_COMMAND_MAP_H
|
#define RTORRENT_RPC_COMMAND_MAP_H
|
||||||
|
|
||||||
@@ -124,7 +88,7 @@ public:
|
|||||||
|
|
||||||
const mapped_type call_command_d(const key_type& key, core::Download* download, const mapped_type& arg) { return call_command(key, arg, target_type((int)command_base::target_download, download)); }
|
const mapped_type call_command_d(const key_type& key, core::Download* download, const mapped_type& arg) { return call_command(key, arg, target_type((int)command_base::target_download, download)); }
|
||||||
const mapped_type call_command_p(const key_type& key, torrent::Peer* peer, const mapped_type& arg) { return call_command(key, arg, target_type((int)command_base::target_peer, peer)); }
|
const mapped_type call_command_p(const key_type& key, torrent::Peer* peer, const mapped_type& arg) { return call_command(key, arg, target_type((int)command_base::target_peer, peer)); }
|
||||||
const mapped_type call_command_t(const key_type& key, torrent::Tracker* tracker, const mapped_type& arg) { return call_command(key, arg, target_type((int)command_base::target_tracker, tracker)); }
|
const mapped_type call_command_t(const key_type& key, torrent::tracker::Tracker* tracker, const mapped_type& arg) { return call_command(key, arg, target_type((int)command_base::target_tracker, tracker)); }
|
||||||
const mapped_type call_command_f(const key_type& key, torrent::File* file, const mapped_type& arg) { return call_command(key, arg, target_type((int)command_base::target_file, file)); }
|
const mapped_type call_command_f(const key_type& key, torrent::File* file, const mapped_type& arg) { return call_command(key, arg, target_type((int)command_base::target_file, file)); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <torrent/common.h>
|
||||||
|
|
||||||
#include "rpc/command.h"
|
#include "rpc/command.h"
|
||||||
#include "rpc/jsonrpc.h"
|
#include "rpc/jsonrpc.h"
|
||||||
@@ -12,12 +13,6 @@ namespace core {
|
|||||||
class Download;
|
class Download;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace torrent {
|
|
||||||
class File;
|
|
||||||
class Object;
|
|
||||||
class Tracker;
|
|
||||||
} // namespace torrent
|
|
||||||
|
|
||||||
namespace rpc {
|
namespace rpc {
|
||||||
|
|
||||||
class rpc_error : public torrent::base_error {
|
class rpc_error : public torrent::base_error {
|
||||||
@@ -38,7 +33,7 @@ class RpcManager {
|
|||||||
public:
|
public:
|
||||||
using slot_download = std::function<core::Download*(const char*)>;
|
using slot_download = std::function<core::Download*(const char*)>;
|
||||||
using slot_file = std::function<torrent::File*(core::Download*, uint32_t)>;
|
using slot_file = std::function<torrent::File*(core::Download*, uint32_t)>;
|
||||||
using slot_tracker = std::function<torrent::Tracker*(core::Download*, uint32_t)>;
|
using slot_tracker = std::function<torrent::tracker::Tracker*(core::Download*, uint32_t)>;
|
||||||
using slot_peer = std::function<torrent::Peer*(core::Download*, const torrent::HashString&)>;
|
using slot_peer = std::function<torrent::Peer*(core::Download*, const torrent::HashString&)>;
|
||||||
using slot_response_callback = std::function<bool(const char*, uint32_t)>;
|
using slot_response_callback = std::function<bool(const char*, uint32_t)>;
|
||||||
|
|
||||||
|
|||||||
+3
-45
@@ -1,66 +1,24 @@
|
|||||||
// rTorrent - BitTorrent client
|
|
||||||
// Copyright (C) 2005-2011, Jari Sundell
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation; either version 2 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
//
|
|
||||||
// In addition, as a special exception, the copyright holders give
|
|
||||||
// permission to link the code of portions of this program with the
|
|
||||||
// OpenSSL library under certain conditions as described in each
|
|
||||||
// individual source file, and distribute linked combinations
|
|
||||||
// including the two.
|
|
||||||
//
|
|
||||||
// You must obey the GNU General Public License in all respects for
|
|
||||||
// all of the code used other than OpenSSL. If you modify file(s)
|
|
||||||
// with this exception, you may extend this exception to your version
|
|
||||||
// of the file(s), but you are not obligated to do so. If you do not
|
|
||||||
// wish to do so, delete this exception statement from your version.
|
|
||||||
// If you delete this exception statement from all source files in the
|
|
||||||
// program, then also delete it here.
|
|
||||||
//
|
|
||||||
// Contact: Jari Sundell <jaris@ifi.uio.no>
|
|
||||||
//
|
|
||||||
// Skomakerveien 33
|
|
||||||
// 3185 Skoppum, NORWAY
|
|
||||||
|
|
||||||
#ifndef RTORRENT_RPC_XMLRPC_H
|
#ifndef RTORRENT_RPC_XMLRPC_H
|
||||||
#define RTORRENT_RPC_XMLRPC_H
|
#define RTORRENT_RPC_XMLRPC_H
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
#include <torrent/common.h>
|
||||||
|
#include <torrent/hash_string.h>
|
||||||
|
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
#include "scgi_task.h"
|
#include "scgi_task.h"
|
||||||
|
|
||||||
#include <torrent/hash_string.h>
|
|
||||||
|
|
||||||
namespace core {
|
namespace core {
|
||||||
class Download;
|
class Download;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace torrent {
|
|
||||||
class File;
|
|
||||||
class Object;
|
|
||||||
class Tracker;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace rpc {
|
namespace rpc {
|
||||||
|
|
||||||
class XmlRpc {
|
class XmlRpc {
|
||||||
public:
|
public:
|
||||||
typedef std::function<core::Download* (const char*)> slot_download;
|
typedef std::function<core::Download* (const char*)> slot_download;
|
||||||
typedef std::function<torrent::File* (core::Download*, uint32_t)> slot_file;
|
typedef std::function<torrent::File* (core::Download*, uint32_t)> slot_file;
|
||||||
typedef std::function<torrent::Tracker* (core::Download*, uint32_t)> slot_tracker;
|
typedef std::function<torrent::tracker::Tracker* (core::Download*, uint32_t)> slot_tracker;
|
||||||
typedef std::function<torrent::Peer* (core::Download*, const torrent::HashString&)> slot_peer;
|
typedef std::function<torrent::Peer* (core::Download*, const torrent::HashString&)> slot_peer;
|
||||||
typedef std::function<bool (const char*, uint32_t)> slot_write;
|
typedef std::function<bool (const char*, uint32_t)> slot_write;
|
||||||
|
|
||||||
|
|||||||
@@ -1,44 +1,8 @@
|
|||||||
// rTorrent - BitTorrent client
|
|
||||||
// Copyright (C) 2005-2011, Jari Sundell
|
|
||||||
//
|
|
||||||
// This program is free software; you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation; either version 2 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
//
|
|
||||||
// In addition, as a special exception, the copyright holders give
|
|
||||||
// permission to link the code of portions of this program with the
|
|
||||||
// OpenSSL library under certain conditions as described in each
|
|
||||||
// individual source file, and distribute linked combinations
|
|
||||||
// including the two.
|
|
||||||
//
|
|
||||||
// You must obey the GNU General Public License in all respects for
|
|
||||||
// all of the code used other than OpenSSL. If you modify file(s)
|
|
||||||
// with this exception, you may extend this exception to your version
|
|
||||||
// of the file(s), but you are not obligated to do so. If you do not
|
|
||||||
// wish to do so, delete this exception statement from your version.
|
|
||||||
// If you delete this exception statement from all source files in the
|
|
||||||
// program, then also delete it here.
|
|
||||||
//
|
|
||||||
// Contact: Jari Sundell <jaris@ifi.uio.no>
|
|
||||||
//
|
|
||||||
// Skomakerveien 33
|
|
||||||
// 3185 Skoppum, NORWAY
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <torrent/exceptions.h>
|
#include <torrent/exceptions.h>
|
||||||
#include <torrent/tracker.h>
|
|
||||||
#include <torrent/tracker_list.h>
|
#include <torrent/tracker_list.h>
|
||||||
|
#include <torrent/tracker/tracker.h>
|
||||||
|
|
||||||
#include "display/frame.h"
|
#include "display/frame.h"
|
||||||
#include "display/window_tracker_list.h"
|
#include "display/window_tracker_list.h"
|
||||||
@@ -103,7 +67,7 @@ ElementTrackerList::receive_disable() {
|
|||||||
if (m_window == NULL)
|
if (m_window == NULL)
|
||||||
throw torrent::internal_error("ui::ElementTrackerList::receive_disable(...) called on a disabled object");
|
throw torrent::internal_error("ui::ElementTrackerList::receive_disable(...) called on a disabled object");
|
||||||
|
|
||||||
torrent::Tracker* t = m_download->download()->tracker_list()->at(m_focus);
|
auto t = m_download->download()->tracker_list()->at(m_focus);
|
||||||
|
|
||||||
if (t->is_enabled())
|
if (t->is_enabled())
|
||||||
t->disable();
|
t->disable();
|
||||||
|
|||||||
Reference in New Issue
Block a user