mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-26 13:13:50 +00:00
fix: speed ACK sent before validation caused client/server desync
If the server sent a NaN or out-of-range speed, the client echoed it back in the ACK (confirming it to the server) but then rejected it locally. This left the server believing the client accepted the speed while the client used the old value — a desync only fixable by relog. Moved validation before the ACK so bad speeds are rejected outright.
This commit is contained in:
parent
3f37ffcea3
commit
1a6960e3f9
1 changed files with 7 additions and 5 deletions
|
|
@ -787,6 +787,13 @@ void MovementHandler::handleForceSpeedChange(network::Packet& packet, const char
|
|||
|
||||
if (guid != owner_.playerGuid) return;
|
||||
|
||||
// Validate BEFORE sending ACK — if we echo a bad speed back to the server
|
||||
// but don't apply it locally, the client and server desync on movement speed.
|
||||
if (std::isnan(newSpeed) || newSpeed < 0.1f || newSpeed > 100.0f) {
|
||||
LOG_WARNING("Ignoring invalid ", name, " speed: ", newSpeed);
|
||||
return;
|
||||
}
|
||||
|
||||
if (owner_.socket) {
|
||||
network::Packet ack(wireOpcode(ackOpcode));
|
||||
const bool legacyGuidAck =
|
||||
|
|
@ -825,11 +832,6 @@ void MovementHandler::handleForceSpeedChange(network::Packet& packet, const char
|
|||
owner_.socket->send(ack);
|
||||
}
|
||||
|
||||
if (std::isnan(newSpeed) || newSpeed < 0.1f || newSpeed > 100.0f) {
|
||||
LOG_WARNING("Ignoring invalid ", name, " speed: ", newSpeed);
|
||||
return;
|
||||
}
|
||||
|
||||
if (speedStorage) *speedStorage = newSpeed;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue