attempt to fix TOS setting (IP type of service)
This commit is contained in:
parent
89ee8463c6
commit
639039a94e
|
@ -105,6 +105,7 @@
|
|||
|
||||
0.15.10 release
|
||||
|
||||
* fixed peer_tos (type of service) setting
|
||||
* fixed crash when loading resume file with more files than the torrent in it
|
||||
* fix invalid-parameter error on windows when disabling filesystem disk cache
|
||||
* fix connection queue issue causing shutdown delays
|
||||
|
|
|
@ -135,16 +135,21 @@ namespace libtorrent
|
|||
|
||||
struct type_of_service
|
||||
{
|
||||
#ifdef WIN32
|
||||
typedef DWORD tos_t;
|
||||
#else
|
||||
typedef int tos_t;
|
||||
#endif
|
||||
type_of_service(char val): m_value(val) {}
|
||||
template<class Protocol>
|
||||
int level(Protocol const&) const { return IPPROTO_IP; }
|
||||
template<class Protocol>
|
||||
int name(Protocol const&) const { return IP_TOS; }
|
||||
template<class Protocol>
|
||||
char const* data(Protocol const&) const { return &m_value; }
|
||||
tos_t const* data(Protocol const&) const { return &m_value; }
|
||||
template<class Protocol>
|
||||
size_t size(Protocol const&) const { return sizeof(m_value); }
|
||||
char m_value;
|
||||
tos_t m_value;
|
||||
};
|
||||
|
||||
#if defined IP_DONTFRAG || defined IP_MTU_DISCOVER || defined IP_DONTFRAGMENT
|
||||
|
|
|
@ -1926,6 +1926,15 @@ namespace aux {
|
|||
if (m_settings.dht_upload_rate_limit != s.dht_upload_rate_limit)
|
||||
m_udp_socket.set_rate_limit(s.dht_upload_rate_limit);
|
||||
|
||||
if (m_settings.peer_tos != s.peer_tos)
|
||||
{
|
||||
error_code ec;
|
||||
m_udp_socket.set_option(type_of_service(s.peer_tos), ec);
|
||||
#if defined TORRENT_VERBOSE_LOGGING
|
||||
(*m_logger) << ">>> SET_TOS[ udp_socket tos: " << s.peer_tos << " e: " << ec.message() << " ]\n";
|
||||
#endif
|
||||
}
|
||||
|
||||
m_settings = s;
|
||||
|
||||
if (m_settings.cache_buffer_chunk_size <= 0)
|
||||
|
@ -2237,6 +2246,12 @@ namespace aux {
|
|||
maybe_update_udp_mapping(1, m_listen_interface.port(), m_listen_interface.port());
|
||||
}
|
||||
|
||||
m_udp_socket.set_option(type_of_service(m_settings.peer_tos), ec);
|
||||
#if defined TORRENT_VERBOSE_LOGGING
|
||||
(*m_logger) << ">>> SET_TOS[ udp_socket tos: " << m_settings.peer_tos << " e: " << ec.message() << " ]\n";
|
||||
#endif
|
||||
ec.clear();
|
||||
|
||||
open_new_incoming_socks_connection();
|
||||
#if TORRENT_USE_I2P
|
||||
open_new_incoming_i2p_connection();
|
||||
|
|
Loading…
Reference in New Issue