mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-05 17:52:29 +00:00
* Added "max_{up,down}loads_{div,global}" options and man page entries.
* PCB::should_request() didn't check if m_downUnchoked was true, just m_downChoke.choked(). This would cause requests to be sent while we were still choked by remote. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@871 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+63
-51
@@ -388,57 +388,6 @@ directory.
|
||||
|
||||
<variablelist>
|
||||
|
||||
<varlistentry>
|
||||
<term>max_peers = <replaceable>value</replaceable></term>
|
||||
<listitem><para>
|
||||
Set the maximum number of peers to allow in each download.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>min_peers = <replaceable>value</replaceable></term>
|
||||
<listitem><para>
|
||||
Set the minimum number of peers to try to connect to in each download.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>max_peers_seed = <replaceable>value</replaceable></term>
|
||||
<listitem><para>
|
||||
Set the maximum number of peers to allow while seeding, or -1 (default) to use
|
||||
max_peers.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>min_peers_seed = <replaceable>value</replaceable></term>
|
||||
<listitem><para>
|
||||
Set the minimum number of peers to try to connect to while seeding, or -1 (default) to use
|
||||
min_peers.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>max_uploads = <replaceable>value</replaceable></term>
|
||||
<listitem><para>
|
||||
Set the maximum number of simultaneous uploads per download.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>download_rate = <replaceable>KB</replaceable></term>
|
||||
<listitem><para>
|
||||
Set the maximum global download rate.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>upload_rate = <replaceable>KB</replaceable></term>
|
||||
<listitem><para>
|
||||
Set the maximum global upload rate.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>bind = <replaceable>a.b.c.d</replaceable></term>
|
||||
<listitem><para>
|
||||
@@ -645,6 +594,69 @@ commands are available.
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>THROTTLE SETTINGS</title>
|
||||
<!-- <para> -->
|
||||
|
||||
<!-- </para> -->
|
||||
|
||||
<variablelist>
|
||||
|
||||
<varlistentry>
|
||||
<term>upload_rate = <replaceable>KB</replaceable></term>
|
||||
<term>download_rate = <replaceable>KB</replaceable></term>
|
||||
<listitem><para>
|
||||
Set the maximum global uploand and download rates.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>min_peers = <replaceable>value</replaceable></term>
|
||||
<term>max_peers = <replaceable>value</replaceable></term>
|
||||
<listitem><para>
|
||||
Set the minimum and maximum number of peers to allow in each download.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>min_peers_seed = <replaceable>value</replaceable></term>
|
||||
<term>max_peers_seed = <replaceable>value</replaceable></term>
|
||||
<listitem><para>
|
||||
Set the minimum nad maximum number of peers to allow while seeding, or
|
||||
-1 (default) to use max_peers.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>max_uploads = <replaceable>value</replaceable></term>
|
||||
<listitem><para>
|
||||
Set the maximum number of simultaneous uploads per download.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>max_uploads_div = <replaceable>value</replaceable></term>
|
||||
<term>max_downloads_div = <replaceable>value</replaceable></term>
|
||||
<listitem><para>
|
||||
Change the divider used to calculate the max upload and download slots
|
||||
to use when the throttle is changed. Disable by
|
||||
setting <emphasis>0</emphasis>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>max_uploads_global = <replaceable>value</replaceable></term>
|
||||
<term>max_downloads_global = <replaceable>value</replaceable></term>
|
||||
<listitem><para>
|
||||
Max upload and download slots allowed. Disable by
|
||||
setting <emphasis>0</emphasis>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1>
|
||||
<title>TRACKER RELATED SETTINGS</title>
|
||||
<para>
|
||||
|
||||
@@ -481,15 +481,19 @@ initialize_variables() {
|
||||
variables->insert("http_proxy", new utils::VariableStringSlot(rak::mem_fn(control->core()->get_poll_manager()->get_http_stack(), &core::CurlStack::http_proxy),
|
||||
rak::mem_fn(control->core()->get_poll_manager()->get_http_stack(), &core::CurlStack::set_http_proxy)));
|
||||
|
||||
variables->insert("max_chunks_queued", new utils::VariableValue(0));
|
||||
variables->insert("min_peers", new utils::VariableValue(40));
|
||||
variables->insert("max_peers", new utils::VariableValue(100));
|
||||
variables->insert("min_peers_seed", new utils::VariableValue(-1));
|
||||
variables->insert("max_peers_seed", new utils::VariableValue(-1));
|
||||
|
||||
variables->insert("max_uploads", new utils::VariableValue(15));
|
||||
variables->insert("max_uploads_div", new utils::VariableValue(1));
|
||||
variables->insert("max_chunks_queued", new utils::VariableValue(0));
|
||||
|
||||
variables->insert("max_downloads_hack", new utils::VariableValueSlot(rak::ptr_fn(&torrent::max_download_unchoked), rak::ptr_fn(&torrent::set_max_download_unchoked)));
|
||||
variables->insert("max_uploads_global", new utils::VariableValueSlot(rak::mem_fn(control->ui(), &ui::Root::max_uploads_global),
|
||||
rak::mem_fn(control->ui(), &ui::Root::set_max_uploads_global)));
|
||||
variables->insert("max_downloads_div", new utils::VariableValue(0));
|
||||
variables->insert("max_downloads_global", new utils::VariableValueSlot(rak::mem_fn(control->ui(), &ui::Root::max_downloads_global),
|
||||
rak::mem_fn(control->ui(), &ui::Root::set_max_downloads_global)));
|
||||
|
||||
variables->insert("download_rate", new utils::VariableValueSlot(rak::ptr_fn(&torrent::down_throttle), rak::mem_fn(control->ui(), &ui::Root::set_down_throttle_i64),
|
||||
0, (1 << 10)));
|
||||
|
||||
+58
-5
@@ -64,7 +64,10 @@ Root::Root() :
|
||||
m_windowTitle(NULL),
|
||||
m_windowHttpQueue(NULL),
|
||||
m_windowInput(NULL),
|
||||
m_windowStatusbar(NULL) {
|
||||
m_windowStatusbar(NULL),
|
||||
|
||||
m_maxUploadsGlobal(0),
|
||||
m_maxDownloadsGlobal(0) {
|
||||
}
|
||||
|
||||
void
|
||||
@@ -162,6 +165,27 @@ Root::set_down_throttle(unsigned int throttle) {
|
||||
m_windowStatusbar->mark_dirty();
|
||||
|
||||
torrent::set_down_throttle(throttle * 1024);
|
||||
|
||||
int64_t div = control->variable()->get_value("max_downloads_div");
|
||||
|
||||
if (throttle == 0 || div <= 0) {
|
||||
torrent::set_max_download_unchoked(m_maxDownloadsGlobal);
|
||||
return;
|
||||
}
|
||||
|
||||
throttle /= control->variable()->get_value("max_downloads_div");
|
||||
|
||||
unsigned int maxUnchoked;
|
||||
|
||||
if (throttle <= 10)
|
||||
maxUnchoked = 1 + throttle / 1;
|
||||
else
|
||||
maxUnchoked = 10 + throttle / 5;
|
||||
|
||||
if (m_maxDownloadsGlobal != 0)
|
||||
torrent::set_max_download_unchoked(std::min(maxUnchoked, m_maxDownloadsGlobal));
|
||||
else
|
||||
torrent::set_max_download_unchoked(maxUnchoked);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -171,17 +195,26 @@ Root::set_up_throttle(unsigned int throttle) {
|
||||
|
||||
torrent::set_up_throttle(throttle * 1024);
|
||||
|
||||
if (throttle == 0) {
|
||||
torrent::set_max_unchoked(0);
|
||||
int64_t div = control->variable()->get_value("max_uploads_div");
|
||||
|
||||
if (throttle == 0 || div <= 0) {
|
||||
torrent::set_max_unchoked(m_maxUploadsGlobal);
|
||||
return;
|
||||
}
|
||||
|
||||
throttle /= control->variable()->get_value("max_uploads_div");
|
||||
|
||||
unsigned int maxUnchoked;
|
||||
|
||||
if (throttle <= 10)
|
||||
torrent::set_max_unchoked(1 + throttle / 1);
|
||||
maxUnchoked = 1 + throttle / 1;
|
||||
else
|
||||
torrent::set_max_unchoked(10 + throttle / 5);
|
||||
maxUnchoked = 10 + throttle / 5;
|
||||
|
||||
if (m_maxUploadsGlobal != 0)
|
||||
torrent::set_max_unchoked(std::min(maxUnchoked, m_maxUploadsGlobal));
|
||||
else
|
||||
torrent::set_max_unchoked(maxUnchoked);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -194,6 +227,26 @@ Root::adjust_up_throttle(int throttle) {
|
||||
set_up_throttle(std::max<int>(torrent::up_throttle() / 1024 + throttle, 0));
|
||||
}
|
||||
|
||||
void
|
||||
Root::set_max_uploads_global(int64_t slots) {
|
||||
if (slots < 0)
|
||||
throw torrent::input_error("Out of range.");
|
||||
|
||||
m_maxUploadsGlobal = slots;
|
||||
|
||||
set_up_throttle(torrent::up_throttle() / 1024);
|
||||
}
|
||||
|
||||
void
|
||||
Root::set_max_downloads_global(int64_t slots) {
|
||||
if (slots < 0)
|
||||
throw torrent::input_error("Out of range.");
|
||||
|
||||
m_maxDownloadsGlobal = slots;
|
||||
|
||||
set_down_throttle(torrent::down_throttle() / 1024);
|
||||
}
|
||||
|
||||
void
|
||||
Root::enable_input(const std::string& title, input::TextInput* input) {
|
||||
if (m_windowInput->input() != NULL)
|
||||
|
||||
@@ -84,6 +84,12 @@ public:
|
||||
void adjust_down_throttle(int throttle);
|
||||
void adjust_up_throttle(int throttle);
|
||||
|
||||
unsigned int max_uploads_global() { return m_maxUploadsGlobal; }
|
||||
void set_max_uploads_global(int64_t slots);
|
||||
|
||||
unsigned int max_downloads_global() { return m_maxDownloadsGlobal; }
|
||||
void set_max_downloads_global(int64_t slots);
|
||||
|
||||
void enable_input(const std::string& title, input::TextInput* input);
|
||||
void disable_input();
|
||||
|
||||
@@ -101,6 +107,9 @@ private:
|
||||
WStatusbar* m_windowStatusbar;
|
||||
|
||||
input::Bindings m_bindings;
|
||||
|
||||
unsigned int m_maxUploadsGlobal;
|
||||
unsigned int m_maxDownloadsGlobal;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user