mirror of
https://github.com/ppy/osu.git
synced 2025-02-14 01:42:59 +08:00
Sanity check received user joined messages
While test failures fixed in 9843da5
were a shortcoming of the test,
they exposed a potential vulnerable point of the multiplayer client
logic. In case of unreliable message delivery it is not unreasonable
that duplicate messages might arrive, in which case the same scenario
that failed in the tests could crash the game.
To ensure that is not the case, explicitly screen each new joined user
against the room user list, to ensure that duplicates do not show up.
`UserLeft` is already tolerant in that respect (if a user is requested
to be removed twice by the server, the second removal just won't do
anything).
This commit is contained in:
parent
47020c8887
commit
a71496bc4e
@ -226,6 +226,10 @@ namespace osu.Game.Online.RealtimeMultiplayer
|
||||
if (Room == null)
|
||||
return;
|
||||
|
||||
// for sanity, ensure that there can be no duplicate users in the room user list.
|
||||
if (Room.Users.Any(existing => existing.UserID == user.UserID))
|
||||
return;
|
||||
|
||||
Room.Users.Add(user);
|
||||
|
||||
RoomChanged?.Invoke();
|
||||
|
Loading…
Reference in New Issue
Block a user