mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-06 18:22:32 +00:00
* Added support for named pipes and proper parseing of arguments for
SCGI. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@906 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+20
-1
@@ -38,6 +38,7 @@
|
||||
|
||||
#include <functional>
|
||||
#include <rak/file_stat.h>
|
||||
#include <rak/path.h>
|
||||
#include <torrent/connection_manager.h>
|
||||
#include <torrent/tracker.h>
|
||||
#include <torrent/tracker_list.h>
|
||||
@@ -184,7 +185,25 @@ apply_scgi(const std::string& arg) {
|
||||
|
||||
// Fix this...
|
||||
control->set_scgi(new rpc::SCgi);
|
||||
control->scgi()->open(5000);
|
||||
|
||||
try {
|
||||
int port;
|
||||
char dummy;
|
||||
|
||||
if (std::sscanf(arg.c_str(), ":%i%c", &port, &dummy) == 1) {
|
||||
if (port <= 0 || port >= (1 << 16))
|
||||
throw torrent::input_error("Invalid port number.");
|
||||
|
||||
control->scgi()->open_port(port);
|
||||
|
||||
} else {
|
||||
control->scgi()->open_named(rak::path_expand(arg));
|
||||
}
|
||||
|
||||
} catch (torrent::local_error& e) {
|
||||
throw torrent::input_error(e.what());
|
||||
}
|
||||
|
||||
control->scgi()->set_slot_process(rak::mem_fn(control->xmlrpc(), &rpc::XmlRpc::process));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user