torrent-reannounce RPC method

This commit is contained in:
orignal committed 2026-10-03 21:36:16 -04:00
1 parent a11971809c
commit 466e99fa55
3 files changed
+40 -3

No files matched your search

+13 -1
View File
@@ -66,6 +66,7 @@ namespace torrents
std::string HandleSessionGet (boost::json::object&& jsonRequest); // for transmission-rpc library
std::string HandleSessionStats (boost::json::object&& jsonRequest);
std::string HandleTorrentSet (boost::json::object&& jsonRequest);
std::string HandleTorrentReannounce (boost::json::object&& jsonRequest);
private:
@@ -123,7 +124,8 @@ namespace torrents
{ "torrent-start", &JSONRPCHandler::HandleTorrentStart },
{ "session-get", &JSONRPCHandler::HandleSessionGet },
{ "session-stats", &JSONRPCHandler::HandleSessionStats },
{ "torrent-set", &JSONRPCHandler::HandleTorrentSet }
{ "torrent-set", &JSONRPCHandler::HandleTorrentSet },
{ "torrent-reannounce", &JSONRPCHandler::HandleTorrentReannounce }
};
try
@@ -213,6 +215,16 @@ namespace torrents
return SuccessResponse (GetTag (jsonRequest), std::move (response));
}
std::string JSONRPCHandler::HandleTorrentReannounce (boost::json::object&& jsonRequest)
{
auto arguments = jsonRequest.at ("arguments").as_object ();
auto torrentIds = GetTorrentIds (arguments);
for (auto id: torrentIds)
m_Tunnel->ReannounceTorrent (id);
boost::json::object response; // always empty
return SuccessResponse (GetTag (jsonRequest), std::move (response));
}
std::string JSONRPCHandler::HandleTorrentGet (boost::json::object&& jsonRequest)
{
auto arguments = jsonRequest.at ("arguments").as_object ();