Cleaned up torrent header files.

This commit is contained in:
Jari Sundell
2026-05-14 12:24:38 +02:00
committed by GitHub
parent 501853cfbc
commit 797a194abc
9 changed files with 26 additions and 8 deletions
+1 -1
View File
@@ -63,7 +63,7 @@ if test ${with_xmlrpc_c+y} && test ${with_xmlrpc_tinyxml2+y}; then
AC_MSG_ERROR([--with-xmlrpc-c and --with-xmlrpc-tinyxml2 cannot be used together. Please choose only one]) AC_MSG_ERROR([--with-xmlrpc-c and --with-xmlrpc-tinyxml2 cannot be used together. Please choose only one])
fi fi
AC_DEFINE(USER_AGENT, [std::string(PACKAGE "/" VERSION "/") + torrent::version()], Http user agent) AC_DEFINE(USER_AGENT, [std::string(PACKAGE "/" VERSION)], Http user agent)
dnl Only update global build variables immediately before generating the output, dnl Only update global build variables immediately before generating the output,
dnl to avoid affecting the global build environment for other autoconf checks. dnl to avoid affecting the global build environment for other autoconf checks.
+2 -1
View File
@@ -11,6 +11,7 @@
#include <torrent/chunk_manager.h> #include <torrent/chunk_manager.h>
#include <torrent/data/file_manager.h> #include <torrent/data/file_manager.h>
#include <torrent/data/chunk_utils.h> #include <torrent/data/chunk_utils.h>
#include <torrent/runtime/runtime.h>
#include <torrent/utils/chrono.h> #include <torrent/utils/chrono.h>
#include <torrent/utils/option_strings.h> #include <torrent/utils/option_strings.h>
@@ -207,7 +208,7 @@ initialize_command_local() {
CMD2_VAR_C_STRING("system.api_version", (int64_t)API_VERSION); CMD2_VAR_C_STRING("system.api_version", (int64_t)API_VERSION);
CMD2_VAR_C_STRING("system.client_version", PACKAGE_VERSION); CMD2_VAR_C_STRING("system.client_version", PACKAGE_VERSION);
CMD2_VAR_C_STRING("system.library_version", torrent::version()); CMD2_VAR_C_STRING("system.library_version", torrent::runtime::version());
CMD2_VAR_VALUE ("system.file.allocate", 0); CMD2_VAR_VALUE ("system.file.allocate", 0);
CMD2_VAR_VALUE ("system.file.max_size", (int64_t)512 << 30); CMD2_VAR_VALUE ("system.file.max_size", (int64_t)512 << 30);
+2 -1
View File
@@ -10,6 +10,7 @@
#include <torrent/net/http_stack.h> #include <torrent/net/http_stack.h>
#include <torrent/net/socket_address.h> #include <torrent/net/socket_address.h>
#include <torrent/runtime/network_config.h> #include <torrent/runtime/network_config.h>
#include <torrent/runtime/runtime.h>
#include <torrent/runtime/socket_manager.h> #include <torrent/runtime/socket_manager.h>
#include <torrent/tracker/tracker.h> #include <torrent/tracker/tracker.h>
#include <torrent/utils/log.h> #include <torrent/utils/log.h>
@@ -288,7 +289,7 @@ initialize_command_network() {
CMD2_ANY ("network.open_files", [file_manager](auto, auto) { return file_manager->open_files(); }); CMD2_ANY ("network.open_files", [file_manager](auto, auto) { return file_manager->open_files(); });
CMD2_ANY ("network.max_open_files", [file_manager](auto, auto) { return file_manager->max_open_files(); }); CMD2_ANY ("network.max_open_files", [file_manager](auto, auto) { return file_manager->max_open_files(); });
CMD2_ANY_VALUE_V ("network.max_open_files.set", [file_manager](auto, auto& value) { return file_manager->set_max_open_files(value); }); CMD2_ANY_VALUE_V ("network.max_open_files.set", [file_manager](auto, auto& value) { return file_manager->set_max_open_files(value); });
CMD2_ANY ("network.total_handshakes", [](auto, auto) { return torrent::total_handshakes(); }); CMD2_ANY ("network.total_handshakes", [](auto, auto) { return torrent::runtime::total_handshakes(); });
CMD2_ANY ("network.open_sockets", [](auto, auto) { return torrent::runtime::socket_manager()->size(); }); CMD2_ANY ("network.open_sockets", [](auto, auto) { return torrent::runtime::socket_manager()->size(); });
CMD2_ANY ("network.max_open_sockets", [](auto, auto) { return torrent::runtime::socket_manager()->max_size(); }); CMD2_ANY ("network.max_open_sockets", [](auto, auto) { return torrent::runtime::socket_manager()->max_size(); });
CMD2_ANY_VALUE_V ("network.max_open_sockets.set", [](auto, auto& value) { return torrent::runtime::socket_manager()->set_max_size(value); }); CMD2_ANY_VALUE_V ("network.max_open_sockets.set", [](auto, auto& value) { return torrent::runtime::socket_manager()->set_max_size(value); });
+1 -1
View File
@@ -121,7 +121,7 @@ Control::is_shutdown_completed() {
if (torrent::net_thread::http_stack()->size() != 0 || !core()->http_queue()->empty()) if (torrent::net_thread::http_stack()->size() != 0 || !core()->http_queue()->empty())
return false; return false;
return torrent::is_inactive(); return core()->is_download_shutdown_completed();
} }
void void
+13 -1
View File
@@ -12,7 +12,6 @@
#include <torrent/utils/resume.h> #include <torrent/utils/resume.h>
#include <torrent/object.h> #include <torrent/object.h>
#include <torrent/connection_manager.h> #include <torrent/connection_manager.h>
#include <torrent/error.h>
#include <torrent/exceptions.h> #include <torrent/exceptions.h>
#include <torrent/object_stream.h> #include <torrent/object_stream.h>
#include <torrent/throttle.h> #include <torrent/throttle.h>
@@ -65,6 +64,19 @@ Manager::~Manager() {
torrent::Throttle::destroy_throttle(m_throttles["NULL"].first); torrent::Throttle::destroy_throttle(m_throttles["NULL"].first);
} }
bool
Manager::is_download_shutdown_completed() {
for (const auto& download : *download_list()) {
if (download->tracker_controller().is_active())
return false;
if (download->tracker_controller().has_active_trackers_not_dht())
return false;
}
return true;
}
void void
Manager::set_hashing_view(View* v) { Manager::set_hashing_view(View* v) {
if (v == nullptr || m_hashingView != nullptr) if (v == nullptr || m_hashingView != nullptr)
+2
View File
@@ -35,6 +35,8 @@ public:
Manager(); Manager();
~Manager(); ~Manager();
bool is_download_shutdown_completed();
DownloadList* download_list() { return m_download_list.get(); } DownloadList* download_list() { return m_download_list.get(); }
FileStatusCache* file_status_cache() { return m_file_status_cache.get(); } FileStatusCache* file_status_cache() { return m_file_status_cache.get(); }
+2 -1
View File
@@ -18,6 +18,7 @@
#include <torrent/net/socket_address.h> #include <torrent/net/socket_address.h>
#include <torrent/peer/client_info.h> #include <torrent/peer/client_info.h>
#include <torrent/runtime/network_config.h> #include <torrent/runtime/network_config.h>
#include <torrent/runtime/runtime.h>
#include <torrent/runtime/socket_manager.h> #include <torrent/runtime/socket_manager.h>
#include "control.h" #include "control.h"
@@ -426,7 +427,7 @@ print_status_extra(char* first, char* last) {
torrent::net_thread::http_stack()->max_total_connections()); torrent::net_thread::http_stack()->max_total_connections());
first = print_buffer(first, last, " [S %i/%i/%i]", first = print_buffer(first, last, " [S %i/%i/%i]",
torrent::total_handshakes(), torrent::runtime::total_handshakes(),
torrent::runtime::socket_manager()->size(), torrent::runtime::socket_manager()->size(),
torrent::runtime::socket_manager()->max_size()); torrent::runtime::socket_manager()->max_size());
+1 -1
View File
@@ -160,7 +160,7 @@ main(int argc, char** argv) {
initialize_rpc_slots(); initialize_rpc_slots();
torrent::initialize(); torrent::initialize();
torrent::set_main_thread_slots(std::bind(&client_perform)); torrent::main_thread::set_client_callback(&client_perform);
scgi::ThreadScgi::create_thread(); scgi::ThreadScgi::create_thread();
session::ThreadSession::create_thread(); session::ThreadSession::create_thread();
+2 -1
View File
@@ -6,6 +6,7 @@
#include <sstream> #include <sstream>
#include <torrent/exceptions.h> #include <torrent/exceptions.h>
#include <torrent/torrent.h> #include <torrent/torrent.h>
#include <torrent/runtime/runtime.h>
#include <torrent/utils/log.h> #include <torrent/utils/log.h>
#include <torrent/utils/string_manip.h> #include <torrent/utils/string_manip.h>
@@ -176,7 +177,7 @@ DownloadList::activate_display(Display displayType) {
switch (displayType) { switch (displayType) {
case DISPLAY_DOWNLOAD_LIST: case DISPLAY_DOWNLOAD_LIST:
control->ui()->window_title()->set_title("rTorrent " PACKAGE_VERSION "/" + control->ui()->window_title()->set_title("rTorrent " PACKAGE_VERSION "/" +
std::string(torrent::version()) + " - " + std::string(torrent::runtime::version()) + " - " +
rpc::call_command_string("session.name")); rpc::call_command_string("session.name"));
break; break;
case DISPLAY_LOG: case DISPLAY_LOG: