Merge pull request #18806 from Chocobo1/buf

Expose 'socket send/receive buffer size' options
This commit is contained in:
Chocobo1
2023-04-07 18:19:46 +08:00
committed by GitHub
9 changed files with 98 additions and 3 deletions

View File

@@ -364,6 +364,10 @@ void AppController::preferencesAction()
data[u"send_buffer_watermark_factor"_qs] = session->sendBufferWatermarkFactor();
// Outgoing connections per second
data[u"connection_speed"_qs] = session->connectionSpeed();
// Socket send buffer size
data[u"socket_send_buffer_size"_qs] = session->socketSendBufferSize();
// Socket receive buffer size
data[u"socket_receive_buffer_size"_qs] = session->socketReceiveBufferSize();
// Socket listen backlog size
data[u"socket_backlog_size"_qs] = session->socketBacklogSize();
// Outgoing ports
@@ -911,6 +915,12 @@ void AppController::setPreferencesAction()
// Outgoing connections per second
if (hasKey(u"connection_speed"_qs))
session->setConnectionSpeed(it.value().toInt());
// Socket send buffer size
if (hasKey(u"socket_send_buffer_size"_qs))
session->setSocketSendBufferSize(it.value().toInt());
// Socket receive buffer size
if (hasKey(u"socket_receive_buffer_size"_qs))
session->setSocketReceiveBufferSize(it.value().toInt());
// Socket listen backlog size
if (hasKey(u"socket_backlog_size"_qs))
session->setSocketBacklogSize(it.value().toInt());

View File

@@ -52,7 +52,7 @@
#include "base/utils/version.h"
#include "api/isessionmanager.h"
inline const Utils::Version<3, 2> API_VERSION {2, 9, 0};
inline const Utils::Version<3, 2> API_VERSION {2, 9, 1};
class APIController;
class AuthController;

View File

@@ -1184,6 +1184,22 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
<input type="text" id="connectionSpeed" style="width: 15em;" />
</td>
</tr>
<tr>
<td>
<label for="socketSendBufferSize">QBT_TR(Socket send buffer size [0: system default]:)QBT_TR[CONTEXT=OptionsDialog]&nbsp;<a href="https://www.libtorrent.org/reference-Settings.html#send_socket_buffer_size" target="_blank">(?)</a></label>
</td>
<td>
<input type="text" id="socketSendBufferSize" style="width: 15em;" />&nbsp;&nbsp;QBT_TR(Bytes)QBT_TR[CONTEXT=OptionsDialog]
</td>
</tr>
<tr>
<td>
<label for="socketReceiveBufferSize">QBT_TR(Socket receive buffer size [0: system default]:)QBT_TR[CONTEXT=OptionsDialog]&nbsp;<a href="https://www.libtorrent.org/reference-Settings.html#recv_socket_buffer_size" target="_blank">(?)</a></label>
</td>
<td>
<input type="text" id="socketReceiveBufferSize" style="width: 15em;" />&nbsp;&nbsp;QBT_TR(Bytes)QBT_TR[CONTEXT=OptionsDialog]
</td>
</tr>
<tr>
<td>
<label for="socketBacklogSize">QBT_TR(Socket backlog size:)QBT_TR[CONTEXT=OptionsDialog]&nbsp;<a href="https://www.libtorrent.org/reference-Settings.html#listen_queue_size" target="_blank">(?)</a></label>
@@ -2145,6 +2161,8 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
$('sendBufferLowWatermark').setProperty('value', pref.send_buffer_low_watermark);
$('sendBufferWatermarkFactor').setProperty('value', pref.send_buffer_watermark_factor);
$('connectionSpeed').setProperty('value', pref.connection_speed);
$('socketSendBufferSize').setProperty('value', pref.socket_send_buffer_size);
$('socketReceiveBufferSize').setProperty('value', pref.socket_receive_buffer_size);
$('socketBacklogSize').setProperty('value', pref.socket_backlog_size);
$('outgoingPortsMin').setProperty('value', pref.outgoing_ports_min);
$('outgoingPortsMax').setProperty('value', pref.outgoing_ports_max);
@@ -2560,6 +2578,8 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
settings.set('send_buffer_low_watermark', $('sendBufferLowWatermark').getProperty('value'));
settings.set('send_buffer_watermark_factor', $('sendBufferWatermarkFactor').getProperty('value'));
settings.set('connection_speed', $('connectionSpeed').getProperty('value'));
settings.set('socket_send_buffer_size', $('socketSendBufferSize').getProperty('value'));
settings.set('socket_receive_buffer_size', $('socketReceiveBufferSize').getProperty('value'));
settings.set('socket_backlog_size', $('socketBacklogSize').getProperty('value'));
settings.set('outgoing_ports_min', $('outgoingPortsMin').getProperty('value'));
settings.set('outgoing_ports_max', $('outgoingPortsMax').getProperty('value'));