From d6bfa7dedc9c5ccde36e4ea7148d9b4716cf9763 Mon Sep 17 00:00:00 2001 From: Dunedan Date: Mon, 12 Aug 2024 17:48:56 +0000 Subject: [PATCH] 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. --- .../public/gui/gamesetup/Controllers/LobbyGameRegistration.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/binaries/data/mods/public/gui/gamesetup/Controllers/LobbyGameRegistration.js b/binaries/data/mods/public/gui/gamesetup/Controllers/LobbyGameRegistration.js index 3757995ca6..26f9f44e58 100644 --- a/binaries/data/mods/public/gui/gamesetup/Controllers/LobbyGameRegistration.js +++ b/binaries/data/mods/public/gui/gamesetup/Controllers/LobbyGameRegistration.js @@ -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;