From 5956043f163534c7f480018d52c9baead87f2d3e Mon Sep 17 00:00:00 2001 From: Glenn Fiedler Date: Wed, 18 Sep 2024 17:54:25 -0400 Subject: [PATCH] add EnablePacketTagging function --- include/yojimbo.h | 8 ++++++++ source/yojimbo.cpp | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/include/yojimbo.h b/include/yojimbo.h index b440cc84..ecc62e6d 100644 --- a/include/yojimbo.h +++ b/include/yojimbo.h @@ -66,6 +66,14 @@ namespace yojimbo bool InitializeYojimbo(); +/** + Enable packet tagging. + Enable before you create any client or servers, and DSCP packet tagging will be applied to all packets sent. + Packet tagging can significantly reduce jitter on modern Wi-Fi 6+ routers, by marking your game traffic to be sent in the real-time queue. + */ + +void EnablePacketTagging(); + /** Shutdown the yojimbo library. Call this after you finish using the library and it will run some checks for you (for example, checking for memory leaks in debug build). diff --git a/source/yojimbo.cpp b/source/yojimbo.cpp index 0bcb35f1..59e0809c 100644 --- a/source/yojimbo.cpp +++ b/source/yojimbo.cpp @@ -44,9 +44,12 @@ namespace yojimbo extern "C" int netcode_init(); extern "C" int reliable_init(); + extern "C" void netcode_term(); extern "C" void reliable_term(); +extern "C" int netcode_enable_packet_tagging(); + #define NETCODE_OK 1 #define RELIABLE_OK 1 @@ -63,6 +66,11 @@ bool InitializeYojimbo() return sodium_init() != -1; } +void EnablePacketTagging() +{ + netcode_enable_packet_tagging(); +} + void ShutdownYojimbo() { reliable_term();