diff --git a/doc/rtorrent.1.xml b/doc/rtorrent.1.xml
index 255756b0..0c19802c 100644
--- a/doc/rtorrent.1.xml
+++ b/doc/rtorrent.1.xml
@@ -474,7 +474,7 @@ seconds, starting from start. An
start and interval may
optionally use a time format, dd:hh:mm:ss. F.ex to
start a task every day at 18:00, use
-18:00:00.
+18:00:00,24:00:00.
@@ -622,6 +622,17 @@ logged at the moment, although disabling it will work as expected.
+
+ tos = default|lowdelay|throughput|reliability|mincost
+
+
+Change the TOS of peer connections, by default set to
+throughput. If the option is set to
+default then the system default TOS is used.
+
+
+
+
diff --git a/rak/socket_address.h b/rak/socket_address.h
index 642147c7..dad2cfa0 100644
--- a/rak/socket_address.h
+++ b/rak/socket_address.h
@@ -64,7 +64,7 @@ class socket_address {
public:
static const sa_family_t af_local = AF_LOCAL;
static const sa_family_t af_unix = AF_UNIX;
- static const sa_family_t af_file = AF_FILE;
+ // static const sa_family_t af_file = AF_FILE;
static const sa_family_t af_inet = AF_INET;
static const sa_family_t af_inet6 = AF_INET6;
static const sa_family_t af_unspec = AF_UNSPEC;
diff --git a/src/core/manager.cc b/src/core/manager.cc
index 7081879d..086db0b8 100644
--- a/src/core/manager.cc
+++ b/src/core/manager.cc
@@ -43,6 +43,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -226,15 +227,16 @@ Manager::listen_open() {
if (control->variable()->get("port_random").as_string() == "yes") {
int boundary = m_portFirst + random() % (m_portLast - m_portFirst + 1);
- if (!torrent::connection_manager()->listen_open(boundary, m_portLast) &&
- !torrent::connection_manager()->listen_open(m_portFirst, boundary))
- throw torrent::input_error("Could not open/bind a port for listening.");
+ if (torrent::connection_manager()->listen_open(boundary, m_portLast) ||
+ torrent::connection_manager()->listen_open(m_portFirst, boundary))
+ return;
} else {
- if (!torrent::connection_manager()->listen_open(m_portFirst, m_portLast))
- throw torrent::input_error("Could not open/bind a port for listening.");
-
+ if (torrent::connection_manager()->listen_open(m_portFirst, m_portLast))
+ return;
}
+
+ throw torrent::input_error("Could not open/bind a port for listening: " + std::string(rak::error_number::current().c_str()));
}
void
diff --git a/src/display/window_download_chunks_seen.cc b/src/display/window_download_chunks_seen.cc
index c5e6e310..dbf9b916 100644
--- a/src/display/window_download_chunks_seen.cc
+++ b/src/display/window_download_chunks_seen.cc
@@ -80,7 +80,7 @@ WindowDownloadChunksSeen::redraw() {
const uint8_t* last = seen + m_download->download()->chunks_total();
for (int y = 1; y < m_canvas->get_height() && chunk < last; ++y) {
- position = buffer + std::max(snprintf(buffer, end - buffer, "%5d", chunk - seen), 0);
+ position = buffer + std::max(snprintf(buffer, end - buffer, "%5d", (int)(chunk - seen)), 0);
while (chunk < last) {
if ((chunk - seen) % 10 == 0) {
diff --git a/src/option_handler_rules.cc b/src/option_handler_rules.cc
index 9fe00cc4..05ec6e61 100644
--- a/src/option_handler_rules.cc
+++ b/src/option_handler_rules.cc
@@ -174,6 +174,29 @@ apply_enable_trackers(Control* m, __UNUSED const std::string& arg) {
}
}
+void
+apply_tos(const std::string& arg) {
+ torrent::ConnectionManager* cm = torrent::connection_manager();
+
+ if (arg == "default")
+ cm->set_priority(torrent::ConnectionManager::iptos_default);
+
+ else if (arg == "lowdelay")
+ cm->set_priority(torrent::ConnectionManager::iptos_lowdelay);
+
+ else if (arg == "throughput")
+ cm->set_priority(torrent::ConnectionManager::iptos_throughput);
+
+ else if (arg == "reliability")
+ cm->set_priority(torrent::ConnectionManager::iptos_reliability);
+
+ else if (arg == "mincost")
+ cm->set_priority(torrent::ConnectionManager::iptos_mincost);
+
+ else
+ throw torrent::input_error("Invalid TOS identifier.");
+}
+
void
initialize_option_handler(Control* c) {
utils::VariableMap* variables = control->variable();
@@ -198,29 +221,31 @@ initialize_option_handler(Control* c) {
variables->insert("bind", new utils::VariableSlotString<>(NULL, rak::mem_fn(control->core(), &core::Manager::set_bind_address)));
variables->insert("ip", new utils::VariableSlotString<>(NULL, rak::mem_fn(control->core(), &core::Manager::set_local_address)));
- variables->insert("min_peers", new utils::VariableValue(40));
- variables->insert("max_peers", new utils::VariableValue(100));
- variables->insert("max_uploads", new utils::VariableValue(15));
+ variables->insert("tos", new utils::VariableSlotString<>(NULL, rak::ptr_fn(&apply_tos)));
- variables->insert("download_rate", new utils::VariableSlotValue(NULL, rak::mem_fn(control->ui(), &ui::Root::set_down_throttle), "%i"));
- variables->insert("upload_rate", new utils::VariableSlotValue(NULL, rak::mem_fn(control->ui(), &ui::Root::set_up_throttle), "%i"));
+ variables->insert("min_peers", new utils::VariableValue(40));
+ variables->insert("max_peers", new utils::VariableValue(100));
+ variables->insert("max_uploads", new utils::VariableValue(15));
- variables->insert("hash_max_tries", new utils::VariableSlotValue(NULL, rak::ptr_fn(&torrent::set_hash_max_tries), "%i"));
- variables->insert("max_open_files", new utils::VariableSlotValue(NULL, rak::ptr_fn(&torrent::set_max_open_files), "%i"));
- variables->insert("max_open_sockets", new utils::VariableSlotValue(NULL, rak::ptr_fn(&torrent::set_max_open_sockets), "%i"));
+ variables->insert("download_rate", new utils::VariableSlotValue(NULL, rak::mem_fn(control->ui(), &ui::Root::set_down_throttle), "%i"));
+ variables->insert("upload_rate", new utils::VariableSlotValue(NULL, rak::mem_fn(control->ui(), &ui::Root::set_up_throttle), "%i"));
- variables->insert("print", new utils::VariableSlotString<>(NULL, rak::mem_fn(control->core(), &core::Manager::push_log)));
- variables->insert("import", new utils::VariableSlotString<>(NULL, rak::mem_fn(control->variable(), &utils::VariableMap::process_file_throw)));
- variables->insert("try_import", new utils::VariableSlotString<>(NULL, rak::mem_fn(control->variable(), &utils::VariableMap::process_file_nothrow)));
+ variables->insert("hash_max_tries", new utils::VariableSlotValue(NULL, rak::ptr_fn(&torrent::set_hash_max_tries), "%i"));
+ variables->insert("max_open_files", new utils::VariableSlotValue(NULL, rak::ptr_fn(&torrent::set_max_open_files), "%i"));
+ variables->insert("max_open_sockets", new utils::VariableSlotValue(NULL, rak::ptr_fn(&torrent::set_max_open_sockets), "%i"));
- variables->insert("schedule", new utils::VariableSlotString<>(NULL, rak::mem_fn(c->command_scheduler(), &CommandScheduler::parse)));
- variables->insert("schedule_remove", new utils::VariableSlotString<>(NULL, rak::mem_fn(c->command_scheduler(), &CommandScheduler::erase)));
+ variables->insert("print", new utils::VariableSlotString<>(NULL, rak::mem_fn(control->core(), &core::Manager::push_log)));
+ variables->insert("import", new utils::VariableSlotString<>(NULL, rak::mem_fn(control->variable(), &utils::VariableMap::process_file_throw)));
+ variables->insert("try_import", new utils::VariableSlotString<>(NULL, rak::mem_fn(control->variable(), &utils::VariableMap::process_file_nothrow)));
- variables->insert("send_buffer_size", new utils::VariableSlotValue(NULL, rak::mem_fn(torrent::connection_manager(),
- &torrent::ConnectionManager::set_send_buffer_size), "%u"));
+ variables->insert("schedule", new utils::VariableSlotString<>(NULL, rak::mem_fn(c->command_scheduler(), &CommandScheduler::parse)));
+ variables->insert("schedule_remove", new utils::VariableSlotString<>(NULL, rak::mem_fn(c->command_scheduler(), &CommandScheduler::erase)));
+
+ variables->insert("send_buffer_size", new utils::VariableSlotValue(NULL, rak::mem_fn(torrent::connection_manager(),
+ &torrent::ConnectionManager::set_send_buffer_size), "%u"));
- variables->insert("receive_buffer_size", new utils::VariableSlotValue(NULL, rak::mem_fn(torrent::connection_manager(),
- &torrent::ConnectionManager::set_receive_buffer_size), "%u"));
+ variables->insert("receive_buffer_size", new utils::VariableSlotValue(NULL, rak::mem_fn(torrent::connection_manager(),
+ &torrent::ConnectionManager::set_receive_buffer_size), "%u"));
// Old.
variables->insert("port_range", new utils::VariableSlotString<>(NULL, rak::bind_ptr_fn(&apply_port_range, c)));