Skip to content

Commit 18d4348

Browse files
author
Bartłomiej Dach
authored
Follow-up fixes for client-side slots implementation (ppy#37868)
Fell out of full-stack testing with ppy/osu-server-spectator#513. - **Fix missing property copy in multiplayer client** Would cause the participant count limit to not update on the multiplayer match screen. - **Fix hard crash when user is kicked from a room with slots active** The kicked user is unsubscribed from receiving room state updates before their slot is vacated, which then would lead this code to attempt to look the local, kicked user via the unvacated slot and thus fail because `client.Room.Users` does *not* contain the user anymore. This is a bit of a dicey change but I think it's less dicey than to try to wiggle ordering server-side.
1 parent dc3dce5 commit 18d4348

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

osu.Game/Online/Multiplayer/MultiplayerClient.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,7 @@ private void updateLocalRoomSettings(MultiplayerRoomSettings settings)
10111011
APIRoom.AutoStartDuration = Room.Settings.AutoStartDuration;
10121012
APIRoom.CurrentPlaylistItem = APIRoom.Playlist.Single(item => item.ID == settings.PlaylistItemId);
10131013
APIRoom.AutoSkip = Room.Settings.AutoSkip;
1014+
APIRoom.MaxParticipants = Room.Settings.MaxParticipants;
10141015

10151016
SettingsChanged?.Invoke(settings);
10161017
RoomUpdated?.Invoke();

osu.Game/Screens/OnlinePlay/Multiplayer/Participants/ParticipantsList.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ private void updateState()
6363

6464
for (byte i = 0; i < slotUserIds.Length; ++i)
6565
{
66-
var participant = slotUserIds[i] == null ? Slot.Empty(i) : Slot.FromUser(client.Room.Users.Single(u => u.UserID == slotUserIds[i]));
66+
var user = slotUserIds[i] != null ? client.Room.Users.SingleOrDefault(u => u.UserID == slotUserIds[i]) : null;
67+
var participant = user == null ? Slot.Empty(i) : Slot.FromUser(client.Room.Users.Single(u => u.UserID == slotUserIds[i]));
6768

6869
if (i >= slots.Count)
6970
slots.Add(participant);

0 commit comments

Comments
 (0)