Fix deferred sending of game updates via XMPP

72f0fdb41b broke the deferred sending of XMPP stanzas for changes to the
game settings during game setup. This change fixes it and decreases the
interval to send game setting updates from 2000ms to 500ms to have
updates faster visible in the multiplayer lobby.

One reason why this bug might have been gone unnoticed so far is that
the traffic shaping employed by ejabberd results in a similar behavior
when just looking at the multiplayer lobby through Pyrogenesis:
After exhausting a certain amount of traffic, clients are only allowed
to send a defined amount of bytes per second. This results in game
setting changes taking a moment before they show up in the multiplayer
lobby. Contrary to the desired behavior, this however leads to all
updates being received and processed by XpartaMuPP resulting in
unnecessary load on the server. With this fix Pyrogenesis doesn't
trigger the traffic shaping on ejabberd side anymore, as there is now
much less traffic being sent by Pyrogenesis.


Patch by: @Dunedan
Accepted by: @Stan
Fixes: #6740

Differential Revision: https://code.wildfiregames.com/D5217
This was SVN commit r28196.
This commit is contained in:
Dunedan 2024-08-12 17:48:56 +00:00
parent 2e67c7f63d
commit d6bfa7dedc

View File

@ -21,7 +21,7 @@ class LobbyGameRegistrationController
// Events
setupWindow.registerClosePageHandler(this.onClosePage.bind(this));
netMessages.registerNetMessageHandler("start", this.onGameStart.bind(this));
playerAssignmentsController.registerPlayerAssignmentsChangeHandler(this.sendImmediately.bind(this));
playerAssignmentsController.registerPlayerAssignmentsChangeHandler(this.onSettingsChange.bind(this));
g_GameSettings.map.watch(() => this.onSettingsChange(), ["map", "type"]);
g_GameSettings.mapSize.watch(() => this.onSettingsChange(), ["size"]);
@ -137,4 +137,4 @@ class LobbyGameRegistrationController
/**
* Send the current game settings to the lobby bot if the settings didn't change for this number of milliseconds.
*/
LobbyGameRegistrationController.prototype.Timeout = 2000;
LobbyGameRegistrationController.prototype.Timeout = 500;