From ad11818868d50e704d98ec28ec12f7ee2a2df9b8 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 12 May 2021 12:19:36 +0900 Subject: [PATCH] Remove watched users on stop watching --- osu.Game/Online/Spectator/SpectatorStreamingClient.cs | 2 +- .../Visual/Spectator/TestSpectatorStreamingClient.cs | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/osu.Game/Online/Spectator/SpectatorStreamingClient.cs b/osu.Game/Online/Spectator/SpectatorStreamingClient.cs index 378096c7fb..691ad5624a 100644 --- a/osu.Game/Online/Spectator/SpectatorStreamingClient.cs +++ b/osu.Game/Online/Spectator/SpectatorStreamingClient.cs @@ -230,7 +230,7 @@ namespace osu.Game.Online.Spectator connection.SendAsync(nameof(ISpectatorServer.StartWatchingUser), userId); } - public void StopWatchingUser(int userId) + public virtual void StopWatchingUser(int userId) { lock (userLock) { diff --git a/osu.Game/Tests/Visual/Spectator/TestSpectatorStreamingClient.cs b/osu.Game/Tests/Visual/Spectator/TestSpectatorStreamingClient.cs index c177d3f399..806d9b45ab 100644 --- a/osu.Game/Tests/Visual/Spectator/TestSpectatorStreamingClient.cs +++ b/osu.Game/Tests/Visual/Spectator/TestSpectatorStreamingClient.cs @@ -38,7 +38,8 @@ namespace osu.Game.Tests.Visual.Spectator RulesetID = 0, }); - userSentStateDictionary[userId] = false; + userBeatmapDictionary.Remove(userId); + userSentStateDictionary.Remove(userId); } public void SendFrames(int userId, int index, int count) @@ -66,10 +67,15 @@ namespace osu.Game.Tests.Visual.Spectator sendState(userId, userBeatmapDictionary[userId]); base.WatchUser(userId); - watchingUsers.Add(userId); } + public override void StopWatchingUser(int userId) + { + base.StopWatchingUser(userId); + watchingUsers.Remove(userId); + } + private void sendState(int userId, int beatmapId) { ((ISpectatorClient)this).UserBeganPlaying(userId, new SpectatorState