add support for TCP_NOTSENT_LOWAT
This commit is contained in:
parent
83bbefc008
commit
65d6e83b1a
|
@ -1,3 +1,4 @@
|
|||
* support TCP_NOTSENT_LOWAT on Linux
|
||||
* fix correct interface binding of local service discovery multicast
|
||||
* fix issue with knowing which interfaces to announce to trackers and DHT
|
||||
* undeprecate settings_pack::dht_upload_rate_limit
|
||||
|
|
|
@ -557,3 +557,5 @@ fe80
|
|||
vcpkg
|
||||
leecher
|
||||
6881l
|
||||
NOTSENT
|
||||
LOWAT
|
||||
|
|
|
@ -42,6 +42,14 @@ namespace aux {
|
|||
template <class Socket>
|
||||
void set_socket_buffer_size(Socket& s, session_settings const& sett, error_code& ec)
|
||||
{
|
||||
#ifdef TCP_NOTSENT_LOWAT
|
||||
int const not_sent_low_watermark = sett.get_int(settings_pack::send_not_sent_low_watermark);
|
||||
if (not_sent_low_watermark)
|
||||
{
|
||||
error_code ignore;
|
||||
s.set_option(tcp_notsent_lowat(not_sent_low_watermark), ignore);
|
||||
}
|
||||
#endif
|
||||
int const snd_size = sett.get_int(settings_pack::send_socket_buffer_size);
|
||||
if (snd_size)
|
||||
{
|
||||
|
|
|
@ -1729,6 +1729,11 @@ namespace aux {
|
|||
// as zero.
|
||||
resolver_cache_timeout,
|
||||
|
||||
// specify the not-sent low watermark for socket send buffers. This
|
||||
// corresponds to the, Linux-specific, ``TCP_NOTSENT_LOWAT`` TCP socket
|
||||
// option.
|
||||
send_not_sent_low_watermark,
|
||||
|
||||
max_int_setting_internal
|
||||
};
|
||||
|
||||
|
|
|
@ -246,6 +246,22 @@ namespace libtorrent {
|
|||
int m_value;
|
||||
};
|
||||
#endif // TORRENT_USE_NETLINK
|
||||
|
||||
#ifdef TCP_NOTSENT_LOWAT
|
||||
struct tcp_notsent_lowat
|
||||
{
|
||||
explicit tcp_notsent_lowat(int val) : m_value(val) {}
|
||||
template<class Protocol>
|
||||
int level(Protocol const&) const { return IPPROTO_TCP; }
|
||||
template<class Protocol>
|
||||
int name(Protocol const&) const { return TCP_NOTSENT_LOWAT; }
|
||||
template<class Protocol>
|
||||
int const* data(Protocol const&) const { return &m_value; }
|
||||
template<class Protocol>
|
||||
std::size_t size(Protocol const&) const { return sizeof(m_value); }
|
||||
int m_value;
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // TORRENT_SOCKET_HPP_INCLUDED
|
||||
|
|
|
@ -236,8 +236,7 @@ namespace {
|
|||
|
||||
set.set_int(settings_pack::max_rejects, 10);
|
||||
|
||||
set.set_int(settings_pack::recv_socket_buffer_size, 1024 * 1024);
|
||||
set.set_int(settings_pack::send_socket_buffer_size, 1024 * 1024);
|
||||
set.set_int(settings_pack::send_not_sent_low_watermark, 524288);
|
||||
|
||||
// don't let connections linger for too long
|
||||
set.set_int(settings_pack::request_timeout, 10);
|
||||
|
|
|
@ -348,6 +348,7 @@ constexpr int CLOSE_FILE_INTERVAL = 0;
|
|||
SET(utp_cwnd_reduce_timer, 100, nullptr),
|
||||
SET(max_web_seed_connections, 3, nullptr),
|
||||
SET(resolver_cache_timeout, 1200, &session_impl::update_resolver_cache_timeout),
|
||||
SET(send_not_sent_low_watermark, 16384, nullptr),
|
||||
}});
|
||||
|
||||
#undef SET
|
||||
|
|
Loading…
Reference in New Issue