Page MenuHomeWildfire Games

Fix lobby gamelist issues when clients join and leave a match.
ClosedPublic

Authored by user1 on Jan 18 2021, 1:04 AM.

Details

Summary

In gui/gamesetup/Controls/PlayerAssignmentControls.js, class playerAssignmentsControl method onPlayerAssignmentMessage:

  • For #5929: Since g_PlayerAssignments was being updated after the onClientJoin and onClientLeave handlers were called and since the handler in gameRegisterStanza was referring to g_PlayerAssignments, it was updating the gamelist with the previous player assignments instead of the new ones.
  • For #5933: Since the handlers for onClientJoin may be registered/called in an inconsistent order, it will sometimes send the gameRegisterStanza before the handler in Pages/GameSetupPage/GameSettings/PerPlayer/Dropdowns/PlayerAssignment.js has assigned the new client to an open player slot.

This patch will:

  • Pass gameRegisterStanza to playerAssignmentsControl constructor.
  • Remove handlers for onClientJoin and onClientLeave from gameRegisterStanza class.
  • Call gameRegisterStanza method sendImmediately only once after all handlers have run and after updating g_PlayerAssignments .
  • Remove from gameRegisterStanza the dependency on playerAssignmentsControl since the onClientJoin and onClientLeave handlers are removed.
Test Plan

Test that the lobby gamelist entry for a match indicates the correct player assignments after a new client joins and after a client leaves a match.
Test that there are no issues while hosting and joining a match by direct connection without the lobby.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

user1 requested review of this revision.Jan 18 2021, 1:04 AM
user1 created this revision.
user1 edited the test plan for this revision. (Show Details)Jan 18 2021, 2:02 AM
Freagarach set the repository for this revision to rP 0 A.D. Public Repository.Jan 18 2021, 7:43 AM
wraitii accepted this revision.Jan 18 2021, 12:14 PM

LGTM, seems to work, cleaner fix than D3394 too.

binaries/data/mods/public/gui/gamesetup/Controls/PlayerAssignmentsControl.js
107 ↗(On Diff #15448)

I did not realise we could use that now :D This is awesome.

This revision is now accepted and ready to land.Jan 18 2021, 12:14 PM
user1 updated this revision to Diff 15475.Jan 18 2021, 4:56 PM

Slight cleanup.

Fixes an indentation.
Make comment span 2 lines instead of 1.

Build is green

builderr-debug-macos.txt
ld: warning: text-based stub file /System/Library/Frameworks//CoreAudio.framework/CoreAudio.tbd and library file /System/Library/Frameworks//CoreAudio.framework/CoreAudio are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox.tbd and library file /System/Library/Frameworks//AudioToolbox.framework/AudioToolbox are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//ForceFeedback.framework/ForceFeedback.tbd and library file /System/Library/Frameworks//ForceFeedback.framework/ForceFeedback are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreVideo.framework/CoreVideo.tbd and library file /System/Library/Frameworks//CoreVideo.framework/CoreVideo are out of sync. Falling back to library file for linking.
ld: warning: text-based stu

See https://jenkins.wildfiregames.com/job/macos-differential/2947/display/redirect for more details.

user1 edited the summary of this revision. (Show Details)Jan 18 2021, 5:35 PM
Stan added a subscriber: Stan.Jan 18 2021, 5:39 PM
Stan added inline comments.
binaries/data/mods/public/gui/gamesetup/Controls/PlayerAssignmentsControl.js
108 ↗(On Diff #15475)

Linter is not happy about it though.

This revision was automatically updated to reflect the committed changes.
Owners added a subscriber: Restricted Owners Package.Jan 18 2021, 5:47 PM