From a92d6960a68d25059c20b18840624f88f52ec4b1 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 1 Feb 2024 18:24:53 -0600 Subject: [PATCH] Enable DSCP tagging in addition to using SO_NET_SERVICE_TYPE on macOS/iOS It appears SO_NET_SERVICE_TYPE doesn't always enable DSCP tagging, so let's do it manually too. --- unix.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/unix.c b/unix.c index 111b9bda..508c35d6 100644 --- a/unix.c +++ b/unix.c @@ -455,7 +455,7 @@ enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value) // iOS/macOS value = value ? NET_SERVICE_TYPE_VO : NET_SERVICE_TYPE_BE; result = setsockopt (socket, SOL_SOCKET, SO_NET_SERVICE_TYPE, (char *) & value, sizeof (int)); -#else +#endif #ifdef IP_TOS // UNIX - IPv4 value = value ? 46 << 2 : 0; // DSCP: Expedited Forwarding @@ -471,7 +471,6 @@ enet_socket_set_option (ENetSocket socket, ENetSocketOption option, int value) value = value ? 6 : 0; // Max priority without NET_CAP_ADMIN result = setsockopt (socket, SOL_SOCKET, SO_PRIORITY, (char *) & value, sizeof (int)); #endif -#endif /* SO_NET_SERVICE_TYPE */ break; case ENET_SOCKOPT_TTL: