mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-04 21:29:21 +00:00
Compare commits
3 Commits
3af0410a6e
...
4c0535b1fa
| Author | SHA1 | Date | |
|---|---|---|---|
| 4c0535b1fa | |||
| d59765fda4 | |||
| 66c49d24e5 |
@@ -86,8 +86,10 @@ initialize_command_system() {
|
||||
CMD_VAR_VALUE ("system.file.split_size", -1);
|
||||
CMD_VAR_STRING ("system.file.split_suffix", ".part");
|
||||
|
||||
CMD_ANY ("system.file_name.replace_slash", [](auto, auto) { return torrent::runtime::client_config()->file_name_replace_slash(); });
|
||||
CMD_ANY_STRING_V("system.file_name.replace_slash.set", [](auto, auto& str) { return torrent::runtime::client_config()->set_file_name_replace_slash(str); });
|
||||
CMD_ANY ("system.file_name.replace_slash", [](auto, auto) { return torrent::runtime::client_config()->file_name_replace_slash(); });
|
||||
CMD_ANY_STRING_V("system.file_name.replace_slash.set", [](auto, auto& str) { return torrent::runtime::client_config()->set_file_name_replace_slash(str); });
|
||||
CMD_ANY ("system.file_name.allow_legacy_utf8", [](auto, auto) { return torrent::runtime::client_config()->file_name_allow_legacy_utf8(); });
|
||||
CMD_ANY_VALUE_V ("system.file_name.allow_legacy_utf8.set", [](auto, auto& value) { return torrent::runtime::client_config()->set_file_name_allow_legacy_utf8(value); });
|
||||
|
||||
CMD_ANY ("system.file_status_cache.size", [](auto, auto) { return control->core()->file_status_cache()->size(); });
|
||||
CMD_ANY_V ("system.file_status_cache.prune", [](auto, auto) { return control->core()->file_status_cache()->prune(); });
|
||||
@@ -167,10 +169,13 @@ initialize_command_system() {
|
||||
rpc::rpc.mark_safe("system.time");
|
||||
rpc::rpc.mark_safe("system.time_seconds");
|
||||
rpc::rpc.mark_safe("system.time_usec");
|
||||
rpc::rpc.mark_safe("system.torrent_name.use_sanitized");
|
||||
rpc::rpc.mark_safe("system.file.allocate");
|
||||
rpc::rpc.mark_safe("system.file.max_size");
|
||||
rpc::rpc.mark_safe("system.file.split_size");
|
||||
rpc::rpc.mark_safe("system.file.split_suffix");
|
||||
rpc::rpc.mark_safe("system.file_name.replace_slash");
|
||||
rpc::rpc.mark_safe("system.file_name.allow_legacy_utf8");
|
||||
|
||||
rpc::rpc.mark_safe("system.sockets.size");
|
||||
rpc::rpc.mark_safe("system.sockets.max_size");
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ public:
|
||||
|
||||
static stack_type* from_data(char* data) { return reinterpret_cast<stack_type*>(data); }
|
||||
|
||||
char buffer[sizeof(torrent::Object) * max_arguments];
|
||||
alignas(optimal_alignment) char buffer[sizeof(torrent::Object) * max_arguments];
|
||||
};
|
||||
|
||||
command_base() : m_copy_helper(nullptr), m_dest_helper(nullptr) {}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "rpc/exec_file.h"
|
||||
|
||||
// #include <cassert>
|
||||
@@ -81,8 +83,9 @@ ExecFile::execute_object(const torrent::Object& rawArgs, int flags) {
|
||||
char* argsBuffer[max_args];
|
||||
char** argsCurrent = argsBuffer;
|
||||
|
||||
// Size of value strings are less than 24.
|
||||
char valueBuffer[buffer_size+1];
|
||||
// On the heap: a buffer of buffer_size does not belong on the stack of whichever thread runs the command.
|
||||
auto valueStorage = std::make_unique<char[]>(buffer_size + 1);
|
||||
char* valueBuffer = valueStorage.get();
|
||||
char* valueCurrent = valueBuffer;
|
||||
|
||||
if (rawArgs.is_list()) {
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ namespace rpc {
|
||||
class ExecFile {
|
||||
public:
|
||||
static constexpr unsigned int max_args = 128;
|
||||
static constexpr unsigned int buffer_size = 4096;
|
||||
static constexpr unsigned int buffer_size = 128 * 1024;
|
||||
|
||||
static constexpr int flag_expand_tilde = 0x1;
|
||||
static constexpr int flag_throw = 0x2;
|
||||
|
||||
Reference in New Issue
Block a user