Changed api for listen ip and bind.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@454 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2005-06-07 01:19:18 +00:00
parent 3092a583ca
commit 2e7333792f
7 changed files with 131 additions and 15 deletions
+2 -2
View File
@@ -47,9 +47,9 @@ Manager::initialize() {
CurlStack::init();
torrent::initialize();
//torrent::initialize();
if (!torrent::listen_open(m_portFirst, m_portLast, m_listenIp))
if (!torrent::listen_open(m_portFirst, m_portLast))
throw std::runtime_error("Could not open port for listening.");
// Register log signals.
-2
View File
@@ -68,7 +68,6 @@ public:
void stop(Download* d);
void set_port_range(int a, int b) { m_portFirst = a; m_portLast = b; }
void set_listen_ip(const std::string& ip) { m_listenIp = ip; }
void debug_tracker() { m_debugTracker = 0; }
@@ -97,7 +96,6 @@ private:
int m_portFirst;
int m_portLast;
std::string m_listenIp;
int m_debugTracker;
};
+3 -2
View File
@@ -56,10 +56,11 @@ WindowStatusbar::redraw() {
else
pos = snprintf(buf + pos, 128 - pos, "%-3i", (int)torrent::get(torrent::THROTTLE_READ_CONST_RATE) / 1024);
m_canvas->print(0, 0, "Throttle U/D: %s Listen: %i Handshakes: %i",
m_canvas->print(0, 0, "Throttle U/D: %s Listen: %s:%i%s Handshakes: %i",
buf,
//m_core->get_dns().empty() ? "<default>" : m_core->get_dns().c_str(),
!torrent::get_ip().empty() ? torrent::get_ip().c_str() : "<default>",
(int)torrent::get(torrent::LISTEN_PORT),
!torrent::get_bind().empty() ? (" Bind: " + torrent::get_bind()).c_str() : "",
(int)torrent::get(torrent::HANDSHAKES_TOTAL));
}
+4 -1
View File
@@ -122,8 +122,8 @@ initialize_option_handler(ui::Control* c, OptionHandler* optionHandler) {
optionHandler->insert("upload_rate", new OptionHandlerInt(c, &apply_global_upload_rate, &validate_rate));
optionHandler->insert("directory", new OptionHandlerDownloadString(dsm, &apply_download_directory, &validate_directory));
optionHandler->insert("ip", new OptionHandlerDownloadString(dsm, &apply_download_ip, &validate_ip));
optionHandler->insert("ip", new OptionHandlerString(c, &apply_ip, &validate_ip));
optionHandler->insert("bind", new OptionHandlerString(c, &apply_bind, &validate_ip));
optionHandler->insert("port", new OptionHandlerString(c, &apply_port_range, &validate_port_range));
}
@@ -190,6 +190,9 @@ main(int argc, char** argv) {
SignalHandler::set_handler(SIGSEGV, sigc::bind(sigc::ptr_fun(&do_panic), SIGSEGV));
SignalHandler::set_handler(SIGBUS, sigc::bind(sigc::ptr_fun(&do_panic), SIGBUS));
// Need to initialize this before parseing options.
torrent::initialize();
if (getenv("HOME"))
load_option_file(getenv("HOME") + std::string("/.rtorrent.rc"), &optionHandler);
+6 -6
View File
@@ -80,11 +80,6 @@ apply_download_directory(core::Download* d, const std::string& arg) {
(d->get_download().get_entry_size() > 1 ? d->get_download().get_name() : ""));
}
void
apply_download_ip(core::Download* d, const std::string& arg) {
d->get_download().set_ip(arg);
}
void
apply_global_download_rate(ui::Control* m, int arg) {
torrent::set(torrent::THROTTLE_READ_CONST_RATE, arg * 1024);
@@ -97,7 +92,12 @@ apply_global_upload_rate(ui::Control* m, int arg) {
void
apply_bind(ui::Control* m, const std::string& arg) {
m->get_core().set_listen_ip(arg);
torrent::set_bind(arg);
}
void
apply_ip(ui::Control* m, const std::string& arg) {
torrent::set_ip(arg);
}
// The arg string *must* have been checked with validate_port_range
+1 -1
View File
@@ -46,11 +46,11 @@ void apply_download_max_peers(core::Download* d, int arg);
void apply_download_max_uploads(core::Download* d, int arg);
void apply_download_directory(core::Download* d, const std::string& arg);
void apply_download_ip(core::Download* d, const std::string& arg);
void apply_global_download_rate(ui::Control* m, int arg);
void apply_global_upload_rate(ui::Control* m, int arg);
void apply_ip(ui::Control* m, const std::string& arg);
void apply_bind(ui::Control* m, const std::string& arg);
void apply_port_range(ui::Control* m, const std::string& arg);