1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-16 14:00:40 +00:00

[ENet] Properly set transfer flags when using custom channels

(cherry picked from commit b96d247ba2)
This commit is contained in:
Fabio Alessandrelli
2023-08-05 12:27:02 +02:00
committed by Yuri Sizov
parent c26722badf
commit dabd733c4c

View File

@@ -343,9 +343,6 @@ Error ENetMultiplayerPeer::put_packet(const uint8_t *p_buffer, int p_buffer_size
int packet_flags = 0; int packet_flags = 0;
int channel = SYSCH_RELIABLE; int channel = SYSCH_RELIABLE;
int tr_channel = get_transfer_channel(); int tr_channel = get_transfer_channel();
if (tr_channel > 0) {
channel = SYSCH_MAX + tr_channel - 1;
} else {
switch (get_transfer_mode()) { switch (get_transfer_mode()) {
case TRANSFER_MODE_UNRELIABLE: { case TRANSFER_MODE_UNRELIABLE: {
packet_flags = ENET_PACKET_FLAG_UNSEQUENCED | ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT; packet_flags = ENET_PACKET_FLAG_UNSEQUENCED | ENET_PACKET_FLAG_UNRELIABLE_FRAGMENT;
@@ -360,6 +357,8 @@ Error ENetMultiplayerPeer::put_packet(const uint8_t *p_buffer, int p_buffer_size
channel = SYSCH_RELIABLE; channel = SYSCH_RELIABLE;
} break; } break;
} }
if (tr_channel > 0) {
channel = SYSCH_MAX + tr_channel - 1;
} }
#ifdef DEBUG_ENABLED #ifdef DEBUG_ENABLED