From 7d61e2d95facff8614fbdfae4c36da33c34ad99e Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 1 Nov 2026 15:07:59 -0600 Subject: [PATCH] Don't provide ENet backpressure when sending large payloads --- src/ControlStream.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ControlStream.c b/src/ControlStream.c index 122c980..e8996f9 100644 --- a/src/ControlStream.c +++ b/src/ControlStream.c @@ -917,7 +917,8 @@ static bool sendMessageEnet(short ptype, unsigned int paylen, const void* payloa err = enet_host_service(client, NULL, 0); // Wait until the packet is actually sent to provide backpressure on senders - if (flags & ENET_PACKET_FLAG_RELIABLE) { + // sending small packets (like the input thread sending mouse/keyboard/gamepad data) + if (paylen < (ENET_HOST_DEFAULT_MTU - 128) && (flags & ENET_PACKET_FLAG_RELIABLE)) { // Don't wait longer than 10 milliseconds to avoid blocking callers for too long for (int i = 0; err >= 0 && i < 10; i++) { // Break on disconnected, acked/freed, or sent (pending ack).