diff --git a/src/peer_connection.cpp b/src/peer_connection.cpp index 984b28938..669d448f3 100644 --- a/src/peer_connection.cpp +++ b/src/peer_connection.cpp @@ -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); diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 5f1bd8796..1b37ad924 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -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);