Skip to content

Commit 2a8cf0b

Browse files
committed
fix(network): preserve original execution order for ACK and WRAPPER commands
1 parent 08c8f8b commit 2a8cf0b

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

Core/GameEngine/Source/GameNetwork/ConnectionManager.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -422,12 +422,26 @@ Bool ConnectionManager::processNetCommand(NetCommandRef *ref) {
422422
NetCommandMsg *msg = ref->getCommand();
423423
NetCommandType cmdType = msg->getNetCommandType();
424424

425+
// Handle ACK commands first (before connection validation)
426+
if ((cmdType == NETCOMMANDTYPE_ACKSTAGE1) ||
427+
(cmdType == NETCOMMANDTYPE_ACKSTAGE2) ||
428+
(cmdType == NETCOMMANDTYPE_ACKBOTH)) {
429+
processAck(msg);
430+
return FALSE;
431+
}
432+
425433
// Early validation checks
426434
if ((m_connections[msg->getPlayerID()] == NULL) && (msg->getPlayerID() != m_localSlot)) {
427435
// if this is from a player that is no longer in the game, then ignore them.
428436
return TRUE;
429437
}
430438

439+
// Handle WRAPPER commands (before second connection validation)
440+
if (cmdType == NETCOMMANDTYPE_WRAPPER) {
441+
processWrapper(ref); // need to send the NetCommandRef since we have to construct the relay for the wrapped command.
442+
return FALSE;
443+
}
444+
431445
if ((msg->getPlayerID() >= 0) && (msg->getPlayerID() < MAX_SLOTS) && (msg->getPlayerID() != m_localSlot)) {
432446
if (m_connections[msg->getPlayerID()] == NULL) {
433447
return TRUE;
@@ -454,15 +468,6 @@ Bool ConnectionManager::processNetCommand(NetCommandRef *ref) {
454468

455469
// Process command by type
456470
switch (cmdType) {
457-
case NETCOMMANDTYPE_ACKSTAGE1:
458-
case NETCOMMANDTYPE_ACKSTAGE2:
459-
case NETCOMMANDTYPE_ACKBOTH:
460-
processAck(msg);
461-
return FALSE;
462-
463-
case NETCOMMANDTYPE_WRAPPER:
464-
processWrapper(ref); // need to send the NetCommandRef since we have to construct the relay for the wrapped command.
465-
return FALSE;
466471

467472
case NETCOMMANDTYPE_FRAMEINFO: {
468473
processFrameInfo((NetFrameCommandMsg *)msg);

0 commit comments

Comments
 (0)