mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2026-10-23 10:42:35 +00:00
torrent-reannounce RPC method
This commit is contained in:
1 parent
a11971809c
commit
466e99fa55
3 files changed
+40
-3
No files matched your search
@@ -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 ();
|
||||
|
||||
Reference in new issue
Block a user