Send unreliable traffic as reliable when we have just one channel

This commit is contained in:
Cameron Gutman 2023-07-16 15:11:09 -05:00
parent 2d0badde9a
commit 2ac25bebaa

View File

@ -634,6 +634,14 @@ static bool sendMessageEnet(short ptype, short paylen, const void* payload, uint
// the peer's supported channel count.
if (!IS_SUNSHINE() || channelId >= peer->channelCount) {
channelId = 0;
// Send unreliable traffic as reliable if we only have one channel.
// This avoids unwanted sequencing between reliable and unreliable
// traffic that can lead to delays.
if (flags == 0) {
flags |= ENET_PACKET_FLAG_RELIABLE;
enetPacket->flags |= ENET_PACKET_FLAG_RELIABLE;
}
}
// Queue the packet to be sent