mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-12-01 02:05:06 +00:00
Don't provide ENet backpressure when sending large payloads
This commit is contained in:
1 parent
4853e70489
commit
7d61e2d95f
1 file changed
+2
-1
+2
-1
@@ -917,7 +917,8 @@ static bool sendMessageEnet(short ptype, unsigned int paylen, const void* payloa
|
|||||||
err = enet_host_service(client, NULL, 0);
|
err = enet_host_service(client, NULL, 0);
|
||||||
|
|
||||||
// Wait until the packet is actually sent to provide backpressure on senders
|
// 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
|
// Don't wait longer than 10 milliseconds to avoid blocking callers for too long
|
||||||
for (int i = 0; err >= 0 && i < 10; i++) {
|
for (int i = 0; err >= 0 && i < 10; i++) {
|
||||||
// Break on disconnected, acked/freed, or sent (pending ack).
|
// Break on disconnected, acked/freed, or sent (pending ack).
|
||||||
|
|||||||
Reference in new issue
Block a user