Skip to content

Commit

Permalink
apply DSCP setting to peers before connecting
Browse files Browse the repository at this point in the history
  • Loading branch information
arvidn committed Jun 30, 2024
1 parent ba3a13c commit 6ef8106
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/peer_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,20 @@ namespace libtorrent {
init();
}

if (m_settings.get_int(settings_pack::peer_dscp) != 0)
{
int const value = m_settings.get_int(settings_pack::peer_dscp);
error_code ec;
aux::set_traffic_class(m_socket, value, ec);
#ifndef TORRENT_DISABLE_LOGGING
if (ec && should_log(peer_log_alert::outgoing))
{
peer_log(peer_log_alert::outgoing, "SET_DSCP", "value: %d e: %s"
, value, ec.message().c_str());
}
#endif
}

// if this is an incoming connection, we're done here
if (!m_connecting)
{
Expand Down Expand Up @@ -6386,19 +6400,6 @@ namespace libtorrent {
return;
}

if (m_settings.get_int(settings_pack::peer_dscp) != 0)
{
int const value = m_settings.get_int(settings_pack::peer_dscp);
aux::set_traffic_class(m_socket, value, ec);
#ifndef TORRENT_DISABLE_LOGGING
if (ec && should_log(peer_log_alert::outgoing))
{
peer_log(peer_log_alert::outgoing, "SET_DSCP", "value: %d e: %s"
, value, ec.message().c_str());
}
#endif
}

#ifndef TORRENT_DISABLE_EXTENSIONS
for (auto const& ext : m_extensions)
{
Expand Down

0 comments on commit 6ef8106

Please sign in to comment.