forked from premiere/premiere-libtorrent
made send buffer watermark configurable
This commit is contained in:
parent
e05f396a5d
commit
4420473b88
|
@ -2459,6 +2459,7 @@ struct session_settings
|
|||
bool use_dht_as_fallback;
|
||||
bool free_torrent_hashes;
|
||||
bool upnp_ignore_nonrouters;
|
||||
int send_buffer_watermark;
|
||||
};
|
||||
</pre>
|
||||
<p><tt class="docutils literal"><span class="pre">user_agent</span></tt> this is the client identification to the tracker.
|
||||
|
@ -2570,6 +2571,11 @@ cannot be passed back to <a class="reference" href="#add-torrent">add_torrent()<
|
|||
should ignore any broadcast response from a device whose address is not the
|
||||
configured router for this machine. i.e. it's a way to not talk to other
|
||||
people's routers by mistake.</p>
|
||||
<p><tt class="docutils literal"><span class="pre">send_buffer_waterbark</span></tt> is the upper limit of the send buffer low-watermark.
|
||||
if the send buffer has fewer bytes than this, we'll read another 16kB block
|
||||
onto it. If set too small, upload rate capacity will suffer. If set too high,
|
||||
memory will be wasted. The actual watermark may be lower than this in case
|
||||
the upload rate is low, this is the upper limit.</p>
|
||||
</div>
|
||||
<div class="section">
|
||||
<h1><a id="pe-settings" name="pe-settings">pe_settings</a></h1>
|
||||
|
|
|
@ -2447,6 +2447,7 @@ that will be sent to the tracker. The user-agent is a good way to identify your
|
|||
bool use_dht_as_fallback;
|
||||
bool free_torrent_hashes;
|
||||
bool upnp_ignore_nonrouters;
|
||||
int send_buffer_watermark;
|
||||
};
|
||||
|
||||
``user_agent`` this is the client identification to the tracker.
|
||||
|
@ -2584,6 +2585,12 @@ should ignore any broadcast response from a device whose address is not the
|
|||
configured router for this machine. i.e. it's a way to not talk to other
|
||||
people's routers by mistake.
|
||||
|
||||
``send_buffer_waterbark`` is the upper limit of the send buffer low-watermark.
|
||||
if the send buffer has fewer bytes than this, we'll read another 16kB block
|
||||
onto it. If set too small, upload rate capacity will suffer. If set too high,
|
||||
memory will be wasted. The actual watermark may be lower than this in case
|
||||
the upload rate is low, this is the upper limit.
|
||||
|
||||
pe_settings
|
||||
===========
|
||||
|
||||
|
|
|
@ -118,6 +118,7 @@ namespace libtorrent
|
|||
#endif
|
||||
, free_torrent_hashes(true)
|
||||
, upnp_ignore_nonrouters(true)
|
||||
, send_buffer_watermark(80 * 1024)
|
||||
{}
|
||||
|
||||
// this is the user agent that will be sent to the tracker
|
||||
|
@ -298,6 +299,14 @@ namespace libtorrent
|
|||
// any upnp devices that don't have an address that matches
|
||||
// our currently configured router.
|
||||
bool upnp_ignore_nonrouters;
|
||||
|
||||
// if the send buffer has fewer bytes than this, we'll
|
||||
// read another 16kB block onto it. If set too small,
|
||||
// upload rate capacity will suffer. If set too high,
|
||||
// memory will be wasted.
|
||||
// The actual watermark may be lower than this in case
|
||||
// the upload rate is low, this is the upper limit.
|
||||
int send_buffer_watermark;
|
||||
};
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
|
|
|
@ -2421,8 +2421,9 @@ namespace libtorrent
|
|||
// otherwise there will be no end to how large it will be!
|
||||
|
||||
int buffer_size_watermark = int(m_statistics.upload_rate()) / 2;
|
||||
if (buffer_size_watermark < 1024) buffer_size_watermark = 1024;
|
||||
else if (buffer_size_watermark > 80 * 1024) buffer_size_watermark = 80 * 1024;
|
||||
if (buffer_size_watermark < 512) buffer_size_watermark = 512;
|
||||
else if (buffer_size_watermark > m_ses.settings().send_buffer_watermark)
|
||||
buffer_size_watermark = m_ses.settings().send_buffer_watermark;
|
||||
|
||||
while (!m_requests.empty()
|
||||
&& (send_buffer_size() + m_reading_bytes < buffer_size_watermark)
|
||||
|
|
Loading…
Reference in New Issue