mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-07 18:52:30 +00:00
* Proper fault handling for bad SCGI requests.
* Cleaned up duplicate code in 'xmlrpc.cc'. * Cleaned up 'parse_commands.h'. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@966 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -144,4 +144,21 @@ CommandMap::call_command(key_type key, const mapped_type& arg, target_type targe
|
||||
}
|
||||
}
|
||||
|
||||
const CommandMap::mapped_type
|
||||
CommandMap::call_command(const_iterator itr, const mapped_type& arg, target_type target) {
|
||||
if ((itr->second.m_target != target.first && itr->second.m_target != target_generic) ||
|
||||
(itr->second.m_target != target_generic && target.second == NULL))
|
||||
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);
|
||||
case target_download: return itr->second.m_downloadSlot(itr->second.m_variable, (core::Download*)target.second, arg);
|
||||
case target_file: return itr->second.m_fileSlot(itr->second.m_variable, (torrent::File*)target.second, arg);
|
||||
case target_peer: return itr->second.m_peerSlot(itr->second.m_variable, (torrent::Peer*)target.second, arg);
|
||||
case target_tracker: return itr->second.m_trackerSlot(itr->second.m_variable, (torrent::Tracker*)target.second, arg);
|
||||
default: throw torrent::internal_error("CommandMap::call_command(...) Invalid target.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user