Skip to content

Commit

Permalink
Enable DSCP tagging in addition to using SO_NET_SERVICE_TYPE on macOS…
Browse files Browse the repository at this point in the history
…/iOS

It appears SO_NET_SERVICE_TYPE doesn't always enable DSCP tagging, so let's do it manually too.
  • Loading branch information
cgutman committed Feb 2, 2024
1 parent a339bf5 commit a92d696
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit a92d696

Please sign in to comment.