* Enforce an http transfer timeout when libcurl fails to honor

it. Also set a 5-minute timeout for (previously unlimited) torrent
transfers and fixes the argument type for curl_easy_setopt values.

* Allows bandwidth throttles to work without floating point support.

* Adds a d.add_peer=host[:port] command to manually add a peer (not
for torrents marked "private"), port is 6881 by default.

* Allows banning the selected peer with "B". No unbanning is possible
yet.

All the above patches were written by Josef Drexler.

* Differentiate between commands that have no target, and those that
take generic targets, when using XMLRPC.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1073 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2008-10-22 13:23:48 +00:00
parent 85f5b7dc46
commit 29ba4ff4bc
14 changed files with 139 additions and 24 deletions
+24 -5
View File
@@ -185,11 +185,30 @@ system_method_has_key(__UNUSED rpc::target_type target, const torrent::Object& r
return torrent::Object((int64_t)(function->find(args.back().as_string().c_str()) != function->end()));
}
torrent::Object
system_method_list_keys(__UNUSED rpc::target_type target, const torrent::Object& rawArgs) {
rpc::CommandFunctionList* function;
rpc::CommandMap::iterator itr = rpc::commands.find(rawArgs.as_string().c_str());
if (itr == rpc::commands.end() ||
(function = dynamic_cast<rpc::CommandFunctionList*>(itr->second.m_variable)) == NULL)
throw torrent::input_error("Command is the wrong type.");
torrent::Object rawResult = torrent::Object::create_list();
torrent::Object::list_type& result = rawResult.as_list();
for (rpc::CommandFunctionList::const_iterator itr = function->begin(), last = function->end(); itr != last; itr++)
result.push_back(itr->first);
return rawResult;
}
void
initialize_command_dynamic() {
CMD_G("system.method.insert", rak::ptr_fn(&system_method_insert));
CMD_G_STRING("system.method.erase", rak::ptr_fn(&system_method_erase));
CMD_G("system.method.set", rak::ptr_fn(&system_method_set));
CMD_G("system.method.set_key", rak::ptr_fn(&system_method_set_key));
CMD_G("system.method.has_key", rak::ptr_fn(&system_method_has_key));
CMD_N ("system.method.insert", rak::ptr_fn(&system_method_insert));
CMD_N_STRING("system.method.erase", rak::ptr_fn(&system_method_erase));
CMD_N ("system.method.set", rak::ptr_fn(&system_method_set));
CMD_N ("system.method.set_key", rak::ptr_fn(&system_method_set_key));
CMD_N ("system.method.has_key", rak::ptr_fn(&system_method_has_key));
CMD_N_STRING("system.method.list_keys", rak::ptr_fn(&system_method_list_keys));
}