mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-08 19:22:29 +00:00
* Clear the DelegatorChunk's when clearing Delegator, so it doesn't
throw on some obscure bug. Not going to be looking for this one anyway as there is a rewrite scheduled. * Added "tos = default|lowdelay|throughput|reliability|mincost" option. * Made EntryList::value_type a pointer, fixed so FileMeta is initialized and path set before Download::open(). git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@662 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+12
-1
@@ -474,7 +474,7 @@ seconds, starting from <emphasis>start</emphasis>. An
|
||||
<emphasis>start</emphasis> and <emphasis>interval</emphasis> may
|
||||
optionally use a time format, <emphasis>dd:hh:mm:ss</emphasis>. F.ex to
|
||||
start a task every day at <emphasis>18:00</emphasis>, use
|
||||
<emphasis>18:00:00</emphasis>.
|
||||
<emphasis>18:00:00,24:00:00</emphasis>.
|
||||
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
@@ -622,6 +622,17 @@ logged at the moment, although disabling it will work as expected.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>tos = <replaceable>default|lowdelay|throughput|reliability|mincost</replaceable></term>
|
||||
<listitem><para>
|
||||
|
||||
Change the TOS of peer connections, by default set to
|
||||
<emphasis>throughput</emphasis>. If the option is set to
|
||||
<emphasis>default</emphasis> then the system default TOS is used.
|
||||
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
|
||||
</refsect1>
|
||||
|
||||
@@ -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;
|
||||
|
||||
+8
-6
@@ -43,6 +43,7 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/select.h>
|
||||
#include <rak/address_info.h>
|
||||
#include <rak/error_number.h>
|
||||
#include <rak/regex.h>
|
||||
#include <rak/string_manip.h>
|
||||
#include <sigc++/bind.h>
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
+42
-17
@@ -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<uint32_t, unsigned int>(NULL, rak::mem_fn(control->ui(), &ui::Root::set_down_throttle), "%i"));
|
||||
variables->insert("upload_rate", new utils::VariableSlotValue<uint32_t, unsigned int>(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<int, uint32_t>(NULL, rak::ptr_fn(&torrent::set_hash_max_tries), "%i"));
|
||||
variables->insert("max_open_files", new utils::VariableSlotValue<int, uint32_t>(NULL, rak::ptr_fn(&torrent::set_max_open_files), "%i"));
|
||||
variables->insert("max_open_sockets", new utils::VariableSlotValue<int, uint32_t>(NULL, rak::ptr_fn(&torrent::set_max_open_sockets), "%i"));
|
||||
variables->insert("download_rate", new utils::VariableSlotValue<uint32_t, unsigned int>(NULL, rak::mem_fn(control->ui(), &ui::Root::set_down_throttle), "%i"));
|
||||
variables->insert("upload_rate", new utils::VariableSlotValue<uint32_t, unsigned int>(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<int, uint32_t>(NULL, rak::ptr_fn(&torrent::set_hash_max_tries), "%i"));
|
||||
variables->insert("max_open_files", new utils::VariableSlotValue<int, uint32_t>(NULL, rak::ptr_fn(&torrent::set_max_open_files), "%i"));
|
||||
variables->insert("max_open_sockets", new utils::VariableSlotValue<int, uint32_t>(NULL, rak::ptr_fn(&torrent::set_max_open_sockets), "%i"));
|
||||
|
||||
variables->insert("schedule", new utils::VariableSlotString<>(NULL, rak::mem_fn<const std::string&>(c->command_scheduler(), &CommandScheduler::parse)));
|
||||
variables->insert("schedule_remove", new utils::VariableSlotString<>(NULL, rak::mem_fn<const std::string&>(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<int, uint32_t>(NULL, rak::mem_fn(torrent::connection_manager(),
|
||||
&torrent::ConnectionManager::set_send_buffer_size), "%u"));
|
||||
variables->insert("schedule", new utils::VariableSlotString<>(NULL, rak::mem_fn<const std::string&>(c->command_scheduler(), &CommandScheduler::parse)));
|
||||
variables->insert("schedule_remove", new utils::VariableSlotString<>(NULL, rak::mem_fn<const std::string&>(c->command_scheduler(), &CommandScheduler::erase)));
|
||||
|
||||
variables->insert("send_buffer_size", new utils::VariableSlotValue<int, uint32_t>(NULL, rak::mem_fn(torrent::connection_manager(),
|
||||
&torrent::ConnectionManager::set_send_buffer_size), "%u"));
|
||||
|
||||
variables->insert("receive_buffer_size", new utils::VariableSlotValue<int, uint32_t>(NULL, rak::mem_fn(torrent::connection_manager(),
|
||||
&torrent::ConnectionManager::set_receive_buffer_size), "%u"));
|
||||
variables->insert("receive_buffer_size", new utils::VariableSlotValue<int, uint32_t>(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)));
|
||||
|
||||
Reference in New Issue
Block a user