* Cycle the order in which downloads are handled during ticks to

ensure resource usage gets spread out over time.

* Changed element_file_list.cc to use te_command.

* File commands on file list iterators will be called on the File
pointed to.

* Fixed some sigc++ 2.1 compile errors.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@992 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2007-10-21 04:27:49 +00:00
parent 78f8b19aa4
commit 61098513c6
18 changed files with 66 additions and 38 deletions
+26
View File
@@ -40,6 +40,7 @@
#include <rak/path.h>
#include <torrent/data/file.h>
#include <torrent/data/file_list.h>
#include <torrent/data/file_list_iterator.h>
#include "core/manager.h"
@@ -85,6 +86,17 @@ apply_f_path_depth(torrent::File* file) {
return (int64_t)file->path()->size();
}
torrent::Object
apply_fi_filename_last(torrent::FileListIterator* itr) {
if (itr->file()->path()->empty())
return "EMPTY";
if (itr->depth() >= itr->file()->path()->size())
return "ERROR";
return itr->file()->path()->at(itr->depth());
}
#define ADD_CF_SLOT(key, function, slot, parm, doc) \
commandFileSlotsItr->set_slot(slot); \
rpc::commands.insert_file(key, commandFileSlotsItr++, &rpc::CommandSlot<torrent::File*>::function, rpc::CommandMap::flag_dont_delete, parm, doc);
@@ -106,6 +118,16 @@ apply_f_path_depth(torrent::File* file) {
#define ADD_CF_STRING_UNI(key, get) \
ADD_CF_SLOT_PUBLIC("f.get_" key, call_unknown, rpc::object_void_fn<torrent::File*>(get), "s:", "")
#define ADD_CFI_SLOT_PUBLIC(key, function, slot, parm, doc) \
commandFileItrSlotsItr->set_slot(slot); \
rpc::commands.insert_file_itr(key, commandFileItrSlotsItr++, &rpc::CommandSlot<torrent::FileListIterator*>::function, rpc::CommandMap::flag_dont_delete | rpc::CommandMap::flag_public_xmlrpc, parm, doc);
#define ADD_CFI_VOID(key, slot) \
ADD_CFI_SLOT_PUBLIC("fi.get_" key, call_unknown, rpc::object_fn(slot), "i:", "")
#define ADD_CFI_VALUE(key, get) \
ADD_CFI_SLOT_PUBLIC("fi." key, call_unknown, rpc::object_void_fn<torrent::FileListIterator*>(get), "i:", "")
void
initialize_command_file() {
ADD_CF_VALUE_UNI("is_created", std::mem_fun(&torrent::File::is_created));
@@ -130,4 +152,8 @@ initialize_command_file() {
ADD_CF_VALUE_UNI("match_depth_next", std::mem_fun(&torrent::File::match_depth_next));
ADD_CF_VALUE_UNI("last_touched", std::mem_fun(&torrent::File::last_touched));
ADD_CFI_VOID("filename_last", &apply_fi_filename_last);
ADD_CFI_VALUE("is_file", std::mem_fun(&torrent::FileListIterator::is_file));
}