mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-14 22:22:31 +00:00
* Bumped the number of incoming connections for SCGI.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1262 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -645,13 +645,15 @@ initialize_command_download() {
|
||||
// Control functinos:
|
||||
//
|
||||
|
||||
CMD2_DL ("d.is_open", CMD2_ON_INFO(is_open));
|
||||
CMD2_DL ("d.is_active", CMD2_ON_INFO(is_active));
|
||||
CMD2_DL ("d.is_hash_checked", std::bind(&torrent::Download::is_hash_checked, CMD2_BIND_DL));
|
||||
CMD2_DL ("d.is_hash_checking", std::bind(&torrent::Download::is_hash_checking, CMD2_BIND_DL));
|
||||
CMD2_DL ("d.is_multi_file", std::bind(&torrent::FileList::is_multi_file, CMD2_BIND_FL));
|
||||
CMD2_DL ("d.is_private", CMD2_ON_INFO(is_private));
|
||||
CMD2_DL ("d.is_pex_active", CMD2_ON_INFO(is_pex_active));
|
||||
CMD2_DL ("d.is_open", CMD2_ON_INFO(is_open));
|
||||
CMD2_DL ("d.is_active", CMD2_ON_INFO(is_active));
|
||||
CMD2_DL ("d.is_hash_checked", std::bind(&torrent::Download::is_hash_checked, CMD2_BIND_DL));
|
||||
CMD2_DL ("d.is_hash_checking", std::bind(&torrent::Download::is_hash_checking, CMD2_BIND_DL));
|
||||
CMD2_DL ("d.is_multi_file", std::bind(&torrent::FileList::is_multi_file, CMD2_BIND_FL));
|
||||
CMD2_DL ("d.is_private", CMD2_ON_INFO(is_private));
|
||||
CMD2_DL ("d.is_pex_active", CMD2_ON_INFO(is_pex_active));
|
||||
CMD2_DL ("d.is_partially_done", CMD2_ON_DATA(is_partially_done));
|
||||
CMD2_DL ("d.is_not_partially_done", CMD2_ON_DATA(is_not_partially_done));
|
||||
|
||||
CMD2_DL_V ("d.resume", std::bind(&core::DownloadList::resume_default, control->core()->download_list(), std::placeholders::_1));
|
||||
CMD2_DL_V ("d.pause", std::bind(&core::DownloadList::pause_default, control->core()->download_list(), std::placeholders::_1));
|
||||
|
||||
+19
-27
@@ -64,6 +64,9 @@
|
||||
#include "download_list.h"
|
||||
#include "download_store.h"
|
||||
|
||||
#define DL_TRIGGER_EVENT(download, event_name) \
|
||||
rpc::commands.call_catch(event_name, rpc::make_target(download), torrent::Object(), "Event '" event_name "' failed: ");
|
||||
|
||||
namespace core {
|
||||
|
||||
inline void
|
||||
@@ -74,16 +77,6 @@ DownloadList::check_contains(Download* d) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
DownloadList::trigger_event(Download* d, const char* event_name) {
|
||||
try {
|
||||
rpc::commands.call(event_name, rpc::make_target(d), torrent::Object());
|
||||
|
||||
} catch (torrent::input_error& e) {
|
||||
control->core()->push_log(("Event '" + std::string(event_name) + "' failed: " + std::string(e.what())).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DownloadList::clear() {
|
||||
std::for_each(begin(), end(), std::bind1st(std::mem_fun(&DownloadList::close), this));
|
||||
@@ -193,7 +186,7 @@ DownloadList::insert(Download* download) {
|
||||
std::for_each(control->view_manager()->begin(), control->view_manager()->end(), std::bind2nd(std::mem_fun(&View::insert), download));
|
||||
std::for_each(control->view_manager()->begin(), control->view_manager()->end(), std::bind2nd(std::mem_fun(&View::filter_download), download));
|
||||
|
||||
rpc::commands.call_catch("event.download.inserted", rpc::make_target(*itr), torrent::Object(), "Download event action failed: ");
|
||||
DL_TRIGGER_EVENT(*itr, "event.download.inserted");
|
||||
|
||||
} catch (torrent::local_error& e) {
|
||||
// Should perhaps relax this, just print an error and remove the
|
||||
@@ -221,7 +214,7 @@ DownloadList::erase(iterator itr) {
|
||||
|
||||
control->core()->download_store()->remove(*itr);
|
||||
|
||||
rpc::commands.call_catch("event.download.erased", rpc::make_target(*itr), torrent::Object(), "Download event action failed: ");
|
||||
DL_TRIGGER_EVENT(*itr, "event.download.erased");
|
||||
std::for_each(control->view_manager()->begin(), control->view_manager()->end(), std::bind2nd(std::mem_fun(&View::erase), *itr));
|
||||
|
||||
torrent::download_remove(*(*itr)->download());
|
||||
@@ -257,7 +250,7 @@ DownloadList::open_throw(Download* download) {
|
||||
openFlags |= torrent::Download::open_enable_fallocate;
|
||||
|
||||
download->download()->open(openFlags);
|
||||
rpc::commands.call_catch("event.download.opened", rpc::make_target(download), torrent::Object(), "Download event action failed: ");
|
||||
DL_TRIGGER_EVENT(download, "event.download.opened");
|
||||
}
|
||||
|
||||
void
|
||||
@@ -322,8 +315,8 @@ DownloadList::close_throw(Download* download) {
|
||||
if (!download->is_hash_failed() && rpc::call_command_value("d.hashing", rpc::make_target(download)) != Download::variable_hashing_stopped)
|
||||
throw torrent::internal_error("DownloadList::close_throw(...) called but we're going into a hashing loop.");
|
||||
|
||||
rpc::commands.call_catch("event.download.hash_removed", rpc::make_target(download), torrent::Object(), "Download event action failed: ");
|
||||
rpc::commands.call_catch("event.download.closed", rpc::make_target(download), torrent::Object(), "Download event action failed: ");
|
||||
DL_TRIGGER_EVENT(download, "event.download.hash_removed");
|
||||
DL_TRIGGER_EVENT(download, "event.download.closed");
|
||||
}
|
||||
|
||||
void
|
||||
@@ -356,7 +349,7 @@ DownloadList::resume(Download* download, int flags) {
|
||||
if (rpc::call_command_value("d.hashing", rpc::make_target(download)) == Download::variable_hashing_stopped)
|
||||
rpc::call_command("d.hashing.set", Download::variable_hashing_initial, rpc::make_target(download));
|
||||
|
||||
rpc::commands.call_catch("event.download.hash_queued", rpc::make_target(download), torrent::Object(), "Download event action failed: ");
|
||||
DL_TRIGGER_EVENT(download, "event.download.hash_queued");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -412,7 +405,7 @@ DownloadList::resume(Download* download, int flags) {
|
||||
|
||||
download->set_resume_flags(~uint32_t());
|
||||
|
||||
rpc::commands.call_catch("event.download.resumed", rpc::make_target(download), torrent::Object(), "Download event action failed: ");
|
||||
DL_TRIGGER_EVENT(download, "event.download.resumed");
|
||||
|
||||
} catch (torrent::local_error& e) {
|
||||
control->core()->push_log(e.what());
|
||||
@@ -435,7 +428,7 @@ DownloadList::pause(Download* download, int flags) {
|
||||
download->download()->hash_stop();
|
||||
rpc::call_command_set_value("d.hashing.set", Download::variable_hashing_stopped, rpc::make_target(download));
|
||||
|
||||
rpc::commands.call_catch("event.download.hash_removed", rpc::make_target(download), torrent::Object(), "Download event action failed: ");
|
||||
DL_TRIGGER_EVENT(download, "event.download.hash_removed");
|
||||
}
|
||||
|
||||
if (!download->download()->info()->is_active())
|
||||
@@ -447,7 +440,7 @@ DownloadList::pause(Download* download, int flags) {
|
||||
// TODO: This is actually for pause, not stop... And doesn't get
|
||||
// called when the download isn't active, but was in the 'started'
|
||||
// view.
|
||||
rpc::commands.call_catch("event.download.paused", rpc::make_target(download), torrent::Object(), "Download event action failed: ");
|
||||
DL_TRIGGER_EVENT(download, "event.download.paused");
|
||||
|
||||
rpc::call_command("d.state_changed.set", cachedTime.seconds(), rpc::make_target(download));
|
||||
rpc::call_command("d.state_counter.set", rpc::call_command_value("d.state_counter", rpc::make_target(download)), rpc::make_target(download));
|
||||
@@ -492,7 +485,7 @@ DownloadList::hash_done(Download* download) {
|
||||
if (!download->is_hash_checked()) {
|
||||
download->set_hash_failed(true);
|
||||
|
||||
rpc::commands.call_catch("event.download.hash_failed", rpc::make_target(download), torrent::Object(), "Download event action failed: ");
|
||||
DL_TRIGGER_EVENT(download, "event.download.hash_failed");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -530,7 +523,6 @@ DownloadList::hash_done(Download* download) {
|
||||
|
||||
if (rpc::call_command_value("d.state", rpc::make_target(download)) == 1)
|
||||
resume(download, download->resume_flags());
|
||||
//rpc::commands.call_catch("scheduler.simple.resume", rpc::make_target(download), torrent::Object(), "Download event action failed: ");
|
||||
|
||||
break;
|
||||
|
||||
@@ -541,7 +533,7 @@ DownloadList::hash_done(Download* download) {
|
||||
} else {
|
||||
download->set_message("Hash check on download completion found bad chunks, consider using \"safe_sync\".");
|
||||
control->core()->push_log("Hash check on download completion found bad chunks, consider using \"safe_sync\".");
|
||||
rpc::commands.call_catch("event.download.hash_final_failed", rpc::make_target(download), torrent::Object(), "Download event action failed: ");
|
||||
DL_TRIGGER_EVENT(download, "event.download.hash_final_failed");
|
||||
}
|
||||
|
||||
// TODO: Should we skip the 'hash_done' event here?
|
||||
@@ -554,7 +546,7 @@ DownloadList::hash_done(Download* download) {
|
||||
return;
|
||||
}
|
||||
|
||||
rpc::commands.call_catch("event.download.hash_done", rpc::make_target(download), torrent::Object(), "Download event action failed: ");
|
||||
DL_TRIGGER_EVENT(download, "event.download.hash_done");
|
||||
}
|
||||
|
||||
void
|
||||
@@ -569,8 +561,8 @@ DownloadList::hash_queue(Download* download, int type) {
|
||||
pause(download, torrent::Download::stop_skip_tracker);
|
||||
download->download()->close();
|
||||
|
||||
rpc::commands.call_catch("event.download.hash_removed", rpc::make_target(download), torrent::Object(), "Download event action failed: ");
|
||||
rpc::commands.call_catch("event.download.closed", rpc::make_target(download), torrent::Object(), "Download event action failed: ");
|
||||
DL_TRIGGER_EVENT(download, "event.download.hash_removed");
|
||||
DL_TRIGGER_EVENT(download, "event.download.closed");
|
||||
}
|
||||
|
||||
torrent::resume_clear_progress(*download->download(), download->download()->bencode()->get_key("libtorrent_resume"));
|
||||
@@ -583,7 +575,7 @@ DownloadList::hash_queue(Download* download, int type) {
|
||||
|
||||
// If any more stuff is added here, make sure resume etc are still
|
||||
// correct.
|
||||
rpc::commands.call_catch("event.download.hash_queued", rpc::make_target(download), torrent::Object(), "Download event action failed: ");
|
||||
DL_TRIGGER_EVENT(download, "event.download.hash_queued");
|
||||
}
|
||||
|
||||
void
|
||||
@@ -647,7 +639,7 @@ DownloadList::confirm_finished(Download* download) {
|
||||
// Save the hash in case the finished event erases it.
|
||||
torrent::HashString infohash = download->info()->hash();
|
||||
|
||||
rpc::commands.call_catch("event.download.finished", rpc::make_target(download), torrent::Object(), "Download event action failed: ");
|
||||
DL_TRIGGER_EVENT(download, "event.download.finished");
|
||||
|
||||
// if (download->resume_flags() != ~uint32_t())
|
||||
// throw torrent::internal_error("DownloadList::confirm_finished(...) download->resume_flags() != ~uint32_t().");
|
||||
|
||||
@@ -155,8 +155,6 @@ private:
|
||||
DownloadList(const DownloadList&);
|
||||
void operator = (const DownloadList&);
|
||||
|
||||
void trigger_event(Download* d, const char* event_name);
|
||||
|
||||
void hash_done(Download* d);
|
||||
void hash_queue(Download* d, int type);
|
||||
|
||||
|
||||
+1
-5
@@ -52,9 +52,8 @@ namespace rpc {
|
||||
class lt_cacheline_aligned SCgi : public torrent::Event {
|
||||
public:
|
||||
typedef rak::function2<bool, const char*, uint32_t> slot_write;
|
||||
// typedef rak::function3<bool, const char*, uint32_t, slot_write> slot_process;
|
||||
|
||||
static const int max_tasks = 10;
|
||||
static const int max_tasks = 30;
|
||||
|
||||
// Global lock:
|
||||
SCgi() : m_logFd(-1) {}
|
||||
@@ -68,8 +67,6 @@ public:
|
||||
|
||||
const std::string& path() const { return m_path; }
|
||||
|
||||
// void set_slot_process(slot_process::base_type* s) { m_slotProcess.set(s); }
|
||||
|
||||
int log_fd() const { return m_logFd; }
|
||||
void set_log_fd(int fd) { m_logFd = fd; }
|
||||
|
||||
@@ -87,7 +84,6 @@ private:
|
||||
|
||||
std::string m_path;
|
||||
int m_logFd;
|
||||
// slot_process m_slotProcess;
|
||||
SCgiTask m_task[max_tasks];
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user