mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-02-06 00:39:54 +00:00
Enable opportunistic QoS tagging for control messages
This commit is contained in:
parent
fe8b0bad92
commit
c7700f96fc
@ -176,11 +176,21 @@ namespace net {
|
|||||||
|
|
||||||
host_t
|
host_t
|
||||||
host_create(af_e af, ENetAddress &addr, std::size_t peers, std::uint16_t port) {
|
host_create(af_e af, ENetAddress &addr, std::size_t peers, std::uint16_t port) {
|
||||||
|
static std::once_flag enet_init_flag;
|
||||||
|
std::call_once(enet_init_flag, []() {
|
||||||
|
enet_initialize();
|
||||||
|
});
|
||||||
|
|
||||||
auto any_addr = net::af_to_any_address_string(af);
|
auto any_addr = net::af_to_any_address_string(af);
|
||||||
enet_address_set_host(&addr, any_addr.data());
|
enet_address_set_host(&addr, any_addr.data());
|
||||||
enet_address_set_port(&addr, port);
|
enet_address_set_port(&addr, port);
|
||||||
|
|
||||||
return host_t { enet_host_create(af == IPV4 ? AF_INET : AF_INET6, &addr, peers, 0, 0, 0) };
|
auto host = host_t { enet_host_create(af == IPV4 ? AF_INET : AF_INET6, &addr, peers, 0, 0, 0) };
|
||||||
|
|
||||||
|
// Enable opportunistic QoS tagging (automatically disables if the network appears to drop tagged packets)
|
||||||
|
enet_socket_set_option(host->socket, ENET_SOCKOPT_QOS, 1);
|
||||||
|
|
||||||
|
return host;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user