only attempt to set the TOS on socket when configured

This commit is contained in:
Arvid Norberg 2014-06-15 17:44:27 +00:00
parent 20ef852461
commit 6d95b48afa
2 changed files with 7 additions and 5 deletions

View File

@ -481,7 +481,7 @@ namespace libtorrent
disconnect(ec);
return;
}
if (m_remote.address().is_v4())
if (m_remote.address().is_v4() && m_ses.settings().peer_tos != 0)
{
m_socket->set_option(type_of_service(m_ses.settings().peer_tos), ec);
#if defined TORRENT_VERBOSE_LOGGING
@ -5577,7 +5577,7 @@ namespace libtorrent
return;
}
if (m_remote.address().is_v4())
if (m_remote.address().is_v4() && m_ses.settings().peer_tos != 0)
{
error_code ec;
m_socket->set_option(type_of_service(m_ses.settings().peer_tos), ec);

View File

@ -1961,7 +1961,7 @@ 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)
if (m_settings.peer_tos != s.peer_tos && s.peer_tos != 0)
{
error_code ec;
m_udp_socket.set_option(type_of_service(s.peer_tos), ec);
@ -2360,10 +2360,12 @@ retry:
m_alerts.post_alert(listen_succeeded_alert(m_listen_interface, listen_succeeded_alert::udp));
}
m_udp_socket.set_option(type_of_service(m_settings.peer_tos), ec);
if (m_settings.peer_tos != 0) {
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";
(*m_logger) << ">>> SET_TOS[ udp_socket tos: " << m_settings.peer_tos << " e: " << ec.message() << " ]\n";
#endif
}
ec.clear();
set_socket_buffer_size(m_udp_socket, m_settings, ec);