mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-10 20:22:31 +00:00
* 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:
+14
-2
@@ -38,6 +38,7 @@
|
||||
|
||||
#include <torrent/exceptions.h>
|
||||
#include <torrent/object.h>
|
||||
#include <torrent/data/file_list_iterator.h>
|
||||
|
||||
#include "command.h"
|
||||
#include "command_map.h"
|
||||
@@ -134,6 +135,7 @@ CommandMap::insert(key_type key, const command_map_data_type src) {
|
||||
case target_any: itr->second.m_anySlot = src.m_anySlot; break;
|
||||
case target_download: itr->second.m_downloadSlot = src.m_downloadSlot; break;
|
||||
case target_file: itr->second.m_fileSlot = src.m_fileSlot; break;
|
||||
case target_file_itr: itr->second.m_fileItrSlot = src.m_fileItrSlot; break;
|
||||
case target_peer: itr->second.m_peerSlot = src.m_peerSlot; break;
|
||||
case target_tracker: itr->second.m_trackerSlot = src.m_trackerSlot; break;
|
||||
default: throw torrent::internal_error("CommandMap::insert(...) Invalid target.");
|
||||
@@ -147,10 +149,20 @@ CommandMap::call_command(key_type key, const mapped_type& arg, target_type targe
|
||||
if (itr == base_type::end())
|
||||
throw torrent::input_error("Command \"" + std::string(key) + "\" does not exist.");
|
||||
|
||||
if ((itr->second.m_target != target.first && itr->second.m_target > target_any) ||
|
||||
(target.second == NULL && itr->second.m_target != target_generic && !(itr->second.m_target == target_any && target.first == target_generic)))
|
||||
if (target.second == NULL &&
|
||||
itr->second.m_target != target_generic &&
|
||||
!(itr->second.m_target == target_any && target.first == target_generic))
|
||||
throw torrent::input_error("Command type mis-match.");
|
||||
|
||||
if (itr->second.m_target != target.first && itr->second.m_target > target_any) {
|
||||
// Mismatch between the target and command type. If it is not
|
||||
// possible to convert, then throw an input error.
|
||||
if (target.first == target_file_itr && itr->second.m_target == target_file)
|
||||
target = target_type((int)target_file, static_cast<torrent::FileListIterator*>(target.second)->file());
|
||||
else
|
||||
throw torrent::input_error("Command type mis-match.");
|
||||
}
|
||||
|
||||
// This _should_ be optimized int just two calls.
|
||||
switch (itr->second.m_target) {
|
||||
case target_generic: return itr->second.m_genericSlot (itr->second.m_variable, arg);
|
||||
|
||||
Reference in New Issue
Block a user