mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-15 22:52:31 +00:00
* Allow binding of the SCGI socket to a specific address, and added
"scgi_dont_route" variable. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@908 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+7
-9
@@ -36,6 +36,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <rak/error_number.h>
|
||||
#include <rak/socket_address.h>
|
||||
#include <sys/un.h>
|
||||
#include <torrent/connection_manager.h>
|
||||
@@ -71,15 +72,12 @@ SCgi::~SCgi() {
|
||||
}
|
||||
|
||||
void
|
||||
SCgi::open_port(uint16_t port) {
|
||||
rak::socket_address sa;
|
||||
sa.sa_inet()->clear();
|
||||
sa.sa_inet()->set_port(port);
|
||||
SCgi::open_port(void* sa, unsigned int length, bool dontRoute) {
|
||||
if (!get_fd().open_stream() ||
|
||||
(dontRoute && !get_fd().set_dont_route(true)))
|
||||
throw torrent::resource_error("Could not open socket for listening: " + std::string(rak::error_number::current().c_str()));
|
||||
|
||||
if (!get_fd().open_stream())
|
||||
throw torrent::resource_error("Could not open socket for listening.");
|
||||
|
||||
open(sa.c_sockaddr(), sa.length());
|
||||
open(sa, length);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -107,7 +105,7 @@ SCgi::open(void* sa, unsigned int length) {
|
||||
!get_fd().set_reuse_address(true) ||
|
||||
!get_fd().bind(*reinterpret_cast<rak::socket_address*>(sa), length) ||
|
||||
!get_fd().listen(max_tasks))
|
||||
throw torrent::resource_error("Could not prepare socket for listening.");
|
||||
throw torrent::resource_error("Could not prepare socket for listening: " + std::string(rak::error_number::current().c_str()));
|
||||
|
||||
torrent::connection_manager()->inc_socket_count();
|
||||
|
||||
|
||||
+3
-3
@@ -59,9 +59,7 @@ public:
|
||||
SCgi() {}
|
||||
virtual ~SCgi();
|
||||
|
||||
void open(void* sa, unsigned int length);
|
||||
|
||||
void open_port(uint16_t port);
|
||||
void open_port(void* sa, unsigned int length, bool dontRoute);
|
||||
void open_named(const std::string& filename);
|
||||
|
||||
const std::string path() const { return m_path; }
|
||||
@@ -77,6 +75,8 @@ public:
|
||||
utils::SocketFd& get_fd() { return *reinterpret_cast<utils::SocketFd*>(&m_fileDesc); }
|
||||
|
||||
private:
|
||||
void open(void* sa, unsigned int length);
|
||||
|
||||
std::string m_path;
|
||||
slot_process m_slotProcess;
|
||||
SCgiTask m_task[max_tasks];
|
||||
|
||||
@@ -67,7 +67,7 @@ SCgiTask::open(SCgi* parent, int fd) {
|
||||
control->poll()->insert_read(this);
|
||||
control->poll()->insert_error(this);
|
||||
|
||||
scgiTimer = rak::timer::current();
|
||||
// scgiTimer = rak::timer::current();
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user