mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2025-07-01 23:35:58 +00:00
Overflow onto channel 0 rather than distributing
This allows the host to make some assumptions about channel IDs
This commit is contained in:
parent
377d37503f
commit
f3b7edbd11
@ -630,18 +630,11 @@ static bool sendMessageEnet(short ptype, short paylen, const void* payload, uint
|
||||
enetPacket->userData = (void*)&packetFreed;
|
||||
enetPacket->freeCallback = enetPacketFreeCb;
|
||||
|
||||
// channelCount == 0 is possible if the peer is disconnected,
|
||||
// so we need to assign channel ID under the enetMutex to prevent
|
||||
// racing updates the peer.
|
||||
if (!IS_SUNSHINE() || peer->channelCount == 0) {
|
||||
// We always use a single channel for GFE.
|
||||
// Always use channel 0 for GFE and if the requested channel exceeds
|
||||
// the peer's supported channel count.
|
||||
if (!IS_SUNSHINE() || channelId >= peer->channelCount) {
|
||||
channelId = 0;
|
||||
}
|
||||
else if (channelId >= peer->channelCount) {
|
||||
// If this peer doesn't support enough channels, distribute the remaining channels onto the ones
|
||||
// the peer does support. We don't use the channel to distinguish traffic types, so this is safe.
|
||||
channelId %= peer->channelCount;
|
||||
}
|
||||
|
||||
// Queue the packet to be sent
|
||||
err = enet_peer_send(peer, channelId, enetPacket);
|
||||
|
Loading…
x
Reference in New Issue
Block a user