mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-10 16:19:23 +00:00
Remove throttle from DHT.
This commit is contained in:
@@ -153,6 +153,4 @@ initialize_command_tracker() {
|
|||||||
|
|
||||||
CMD2_ANY_STRING ("dht.add_node", std::bind(&apply_dht_add_node, std::placeholders::_2));
|
CMD2_ANY_STRING ("dht.add_node", std::bind(&apply_dht_add_node, std::placeholders::_2));
|
||||||
CMD2_ANY ("dht.statistics", std::bind(&core::DhtManager::dht_statistics, dht_manager));
|
CMD2_ANY ("dht.statistics", std::bind(&core::DhtManager::dht_statistics, dht_manager));
|
||||||
CMD2_ANY ("dht.throttle.name", std::bind(&core::DhtManager::throttle_name, dht_manager));
|
|
||||||
CMD2_ANY_STRING_V ("dht.throttle.name.set", std::bind(&core::DhtManager::set_throttle_name, dht_manager, std::placeholders::_2));
|
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-20
@@ -81,10 +81,6 @@ DhtManager::start_dht() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
torrent::ThrottlePair throttles = control->core()->get_throttle(m_throttleName);
|
|
||||||
torrent::dht_controller()->set_upload_throttle(throttles.first);
|
|
||||||
torrent::dht_controller()->set_download_throttle(throttles.second);
|
|
||||||
|
|
||||||
if (!torrent::dht_controller()->start()) {
|
if (!torrent::dht_controller()->start()) {
|
||||||
m_start = dht_off;
|
m_start = dht_off;
|
||||||
return;
|
return;
|
||||||
@@ -233,13 +229,11 @@ DhtManager::log_statistics(bool force) {
|
|||||||
if ((force && stats.cycle != m_dhtPrevCycle) || stats.cycle == 3 || stats.cycle > m_dhtPrevCycle + 7) {
|
if ((force && stats.cycle != m_dhtPrevCycle) || stats.cycle == 3 || stats.cycle > m_dhtPrevCycle + 7) {
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
snprintf(buffer, sizeof(buffer),
|
snprintf(buffer, sizeof(buffer),
|
||||||
"DHT statistics: %d queries in, %d queries out, %d replies received, %lld bytes read, %lld bytes sent, "
|
"DHT statistics: %d queries in, %d queries out, %d replies received, "
|
||||||
"%d known nodes in %d buckets, %d peers (highest: %d) tracked in %d torrents.",
|
"%d known nodes in %d buckets, %d peers (highest: %d) tracked in %d torrents.",
|
||||||
stats.queries_received - m_dhtPrevQueriesReceived,
|
stats.queries_received - m_dhtPrevQueriesReceived,
|
||||||
stats.queries_sent - m_dhtPrevQueriesSent,
|
stats.queries_sent - m_dhtPrevQueriesSent,
|
||||||
stats.replies_received - m_dhtPrevRepliesReceived,
|
stats.replies_received - m_dhtPrevRepliesReceived,
|
||||||
(long long unsigned int)(stats.down_rate.total() - m_dhtPrevBytesDown),
|
|
||||||
(long long unsigned int)(stats.up_rate.total() - m_dhtPrevBytesUp),
|
|
||||||
stats.num_nodes,
|
stats.num_nodes,
|
||||||
stats.num_buckets,
|
stats.num_buckets,
|
||||||
stats.num_peers,
|
stats.num_peers,
|
||||||
@@ -252,8 +246,6 @@ DhtManager::log_statistics(bool force) {
|
|||||||
m_dhtPrevQueriesSent = stats.queries_sent;
|
m_dhtPrevQueriesSent = stats.queries_sent;
|
||||||
m_dhtPrevRepliesReceived = stats.replies_received;
|
m_dhtPrevRepliesReceived = stats.replies_received;
|
||||||
m_dhtPrevQueriesReceived = stats.queries_received;
|
m_dhtPrevQueriesReceived = stats.queries_received;
|
||||||
m_dhtPrevBytesUp = stats.up_rate.total();
|
|
||||||
m_dhtPrevBytesDown = stats.down_rate.total();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -265,7 +257,7 @@ DhtManager::dht_statistics() {
|
|||||||
|
|
||||||
dhtStats.insert_key("dht", dht_settings[m_start]);
|
dhtStats.insert_key("dht", dht_settings[m_start]);
|
||||||
dhtStats.insert_key("active", torrent::dht_controller()->is_active());
|
dhtStats.insert_key("active", torrent::dht_controller()->is_active());
|
||||||
dhtStats.insert_key("throttle", m_throttleName);
|
dhtStats.insert_key("throttle", "");
|
||||||
|
|
||||||
if (torrent::dht_controller()->is_active()) {
|
if (torrent::dht_controller()->is_active()) {
|
||||||
auto stats = torrent::dht_controller()->get_statistics();
|
auto stats = torrent::dht_controller()->get_statistics();
|
||||||
@@ -276,8 +268,8 @@ DhtManager::dht_statistics() {
|
|||||||
dhtStats.insert_key("replies_received", stats.replies_received);
|
dhtStats.insert_key("replies_received", stats.replies_received);
|
||||||
dhtStats.insert_key("errors_received", stats.errors_received);
|
dhtStats.insert_key("errors_received", stats.errors_received);
|
||||||
dhtStats.insert_key("errors_caught", stats.errors_caught);
|
dhtStats.insert_key("errors_caught", stats.errors_caught);
|
||||||
dhtStats.insert_key("bytes_read", stats.down_rate.total());
|
dhtStats.insert_key("bytes_read", int64_t());
|
||||||
dhtStats.insert_key("bytes_written", stats.up_rate.total());
|
dhtStats.insert_key("bytes_written", int64_t());
|
||||||
dhtStats.insert_key("nodes", stats.num_nodes);
|
dhtStats.insert_key("nodes", stats.num_nodes);
|
||||||
dhtStats.insert_key("buckets", stats.num_buckets);
|
dhtStats.insert_key("buckets", stats.num_buckets);
|
||||||
dhtStats.insert_key("peers", stats.num_peers);
|
dhtStats.insert_key("peers", stats.num_peers);
|
||||||
@@ -288,12 +280,4 @@ DhtManager::dht_statistics() {
|
|||||||
return dhtStats;
|
return dhtStats;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
DhtManager::set_throttle_name(const std::string& throttleName) {
|
|
||||||
if (torrent::dht_controller()->is_active())
|
|
||||||
throw torrent::input_error("Cannot set DHT throttle while active.");
|
|
||||||
|
|
||||||
m_throttleName = throttleName;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,9 +20,6 @@ public:
|
|||||||
|
|
||||||
void set_mode(const std::string& arg);
|
void set_mode(const std::string& arg);
|
||||||
|
|
||||||
void set_throttle_name(const std::string& throttleName);
|
|
||||||
const std::string& throttle_name() const { return m_throttleName; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int dht_disable = 0;
|
static const int dht_disable = 0;
|
||||||
static const int dht_off = 1;
|
static const int dht_off = 1;
|
||||||
@@ -47,8 +44,6 @@ private:
|
|||||||
|
|
||||||
bool m_warned{};
|
bool m_warned{};
|
||||||
int m_start{dht_off};
|
int m_start{dht_off};
|
||||||
|
|
||||||
std::string m_throttleName;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -418,6 +418,8 @@ main(int argc, char** argv) {
|
|||||||
|
|
||||||
// Deprecate:
|
// Deprecate:
|
||||||
|
|
||||||
|
CMD2_VAR_STRING("dht.throttle.name", "deprecated");
|
||||||
|
|
||||||
CMD2_REDIRECT("network.http.max_open", "network.http.max_total_connections");
|
CMD2_REDIRECT("network.http.max_open", "network.http.max_total_connections");
|
||||||
CMD2_REDIRECT("network.http.max_open.set", "network.http.max_total_connections.set");
|
CMD2_REDIRECT("network.http.max_open.set", "network.http.max_total_connections.set");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user