diff --git a/include/command_helpers.h b/include/command_helpers.h index 16085f51..8514b522 100644 --- a/include/command_helpers.h +++ b/include/command_helpers.h @@ -36,7 +36,7 @@ cleanup_commands(); #define CMD2_ANY(key, slot, is_readonly) \ do \ { \ - if (is_readonly) readonly_command.insert(key); \ + if (is_readonly) rpc::readonly_command.insert(key); \ CMD2_A_FUNCTION(key, command_base_call, slot, "i:", "") \ } while (0) \ diff --git a/include/globals.h b/include/globals.h index e7e34f8e..e2389fb2 100644 --- a/include/globals.h +++ b/include/globals.h @@ -4,7 +4,6 @@ #ifndef TORRENT_GLOBALS_H #define TORRENT_GLOBALS_H -#include #include #include @@ -25,6 +24,4 @@ extern torrent::utils::timer cachedTime; extern Control* control; extern RpcThreadManager* worker_thread; -extern std::unordered_set readonly_command; - #endif diff --git a/include/rpc/command.h b/include/rpc/command.h index 0af8331e..d9a8a690 100644 --- a/include/rpc/command.h +++ b/include/rpc/command.h @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -25,6 +26,8 @@ class Tracker; namespace rpc { +extern std::unordered_set readonly_command; + template struct target_wrapper { using target_type = Target; diff --git a/src/globals.cc b/src/globals.cc index 50fb0ac6..4bee896d 100644 --- a/src/globals.cc +++ b/src/globals.cc @@ -7,6 +7,4 @@ torrent::utils::priority_queue_default taskScheduler; torrent::utils::timer cachedTime; Control* control = nullptr; -RpcThreadManager* worker_thread = nullptr; - -std::unordered_set readonly_command = {}; +RpcThreadManager* worker_thread = nullptr; \ No newline at end of file diff --git a/src/rpc/command.cc b/src/rpc/command.cc index ac06089a..a1dada86 100644 --- a/src/rpc/command.cc +++ b/src/rpc/command.cc @@ -34,6 +34,8 @@ namespace rpc { +std::unordered_set readonly_command = {}; + template const torrent::Object command_base_call(command_base* rawCommand, diff --git a/src/rpc/rpc_json.cc b/src/rpc/rpc_json.cc index f4d6d242..85c30a3e 100644 --- a/src/rpc/rpc_json.cc +++ b/src/rpc/rpc_json.cc @@ -24,7 +24,6 @@ #include "rpc/parse_commands.h" #include "thread_base.h" #include "utils/jsonrpc/common.h" -#include "globals.h" using jsonrpccxx::JsonRpcException; using nlohmann::json;