epee: skip IPv4 TOS option for non-IPv4 peers

This commit is contained in:
iuyua9
2026-05-09 20:46:42 +08:00
parent 539012f5b4
commit 5a3f57d6c3
@@ -962,14 +962,16 @@ namespace net_utils
ec_t ec;
#if !defined(_WIN32) || !defined(__i686)
connection_basic::socket_.next_layer().set_option(
boost::asio::detail::socket_option::integer<IPPROTO_IP, IP_TOS>{
connection_basic::get_tos_flag()
},
ec
);
if (ec.value())
return false;
if (real_remote->get_type_id() == ipv4_network_address::get_type_id()) {
connection_basic::socket_.next_layer().set_option(
boost::asio::detail::socket_option::integer<IPPROTO_IP, IP_TOS>{
connection_basic::get_tos_flag()
},
ec
);
if (ec.value())
return false;
}
#endif
connection_basic::socket_.next_layer().set_option(
boost::asio::ip::tcp::no_delay{false},