Skip to content

Commit

Permalink
add EnablePacketTagging function
Browse files Browse the repository at this point in the history
  • Loading branch information
gafferongames committed Sep 18, 2024
1 parent b8a7f03 commit 5956043
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions include/yojimbo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
8 changes: 8 additions & 0 deletions source/yojimbo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -63,6 +66,11 @@ bool InitializeYojimbo()
return sodium_init() != -1;
}

void EnablePacketTagging()
{
netcode_enable_packet_tagging();
}

void ShutdownYojimbo()
{
reliable_term();
Expand Down

0 comments on commit 5956043

Please sign in to comment.