Fixed uninitialized rpc slots when SCGI is not used.

This commit is contained in:
Jari Sundell
2025-08-25 08:56:15 +02:00
committed by GitHub
parent bb1cdfc0e7
commit d35a8d68e6
6 changed files with 68 additions and 56 deletions
+4 -4
View File
@@ -27,7 +27,7 @@ CommandMap::insert(const key_type& key, int flags, const char* parm, const char*
throw torrent::internal_error("CommandMap::insert(...) tried to insert an already existing key.");
// TODO: This is not honoring the public_xmlrpc flags!!!
if (rpc::rpc.is_initialized() && (flags & flag_public_rpc))
if (rpc::rpc.is_handlers_initialized() && (flags & flag_public_rpc))
rpc::rpc.insert_command(key.c_str(), parm, doc);
return base_type::insert(itr, value_type(key, command_map_data_type(flags, parm, doc)));
@@ -55,10 +55,10 @@ CommandMap::create_redirect(const key_type& key_new, const key_type& key_dest, i
if (dest_itr == base_type::end())
throw torrent::input_error("Tried to redirect to a key that doesn't exist: '" + std::string(key_dest) + "'.");
if (new_itr != base_type::end())
throw torrent::input_error("Tried to create a redirect key that already exists: '" + std::string(key_new) + "'.");
if (dest_itr->second.m_flags & flag_is_redirect)
throw torrent::input_error("Tried to redirect to a key that is not marked 'flag_is_redirect': '" +
std::string(key_dest) + "'.");
@@ -68,7 +68,7 @@ CommandMap::create_redirect(const key_type& key_new, const key_type& key_dest, i
flags |= dest_itr->second.m_flags & ~(flag_has_redirects | flag_public_rpc);
// TODO: This is not honoring the public_xmlrpc flags!!!
if (rpc::rpc.is_initialized() && (flags & flag_public_rpc))
if (rpc::rpc.is_handlers_initialized() && (flags & flag_public_rpc))
rpc::rpc.insert_command(key_new.c_str(), dest_itr->second.m_parm, dest_itr->second.m_doc);
iterator itr = base_type::insert(base_type::end(),