diff --git a/osu.Server.Spectator/ConcurrentConnectionLimiter.cs b/osu.Server.Spectator/ConcurrentConnectionLimiter.cs index ae899965..bdfa9d51 100644 --- a/osu.Server.Spectator/ConcurrentConnectionLimiter.cs +++ b/osu.Server.Spectator/ConcurrentConnectionLimiter.cs @@ -99,7 +99,7 @@ private void log(HubLifetimeContext context, string message) using (var userState = await connectionStates.GetForUse(userId)) { - if (userState.Item?.IsInvocationPermitted(invocationContext) != true) + if (userState.Item?.ExistingConnectionMatches(invocationContext) != true) throw new InvalidOperationException($"State is not valid for this connection, context: {LoggingHubFilter.GetMethodCallDisplayString(invocationContext)})"); } @@ -121,7 +121,7 @@ private async Task unregisterConnection(HubLifetimeContext context, Exception? e using (var userState = await connectionStates.GetForUse(userId, true)) { - if (userState.Item?.CanCleanUpConnection(context) == true) + if (userState.Item?.ExistingConnectionMatches(context) == true) { log(context, "disconnected from hub"); userState.Item!.ConnectionIds.Remove(context.Hub.GetType()); diff --git a/osu.Server.Spectator/Entities/ConnectionState.cs b/osu.Server.Spectator/Entities/ConnectionState.cs index b79cc9a0..48de19e9 100644 --- a/osu.Server.Spectator/Entities/ConnectionState.cs +++ b/osu.Server.Spectator/Entities/ConnectionState.cs @@ -68,7 +68,7 @@ public bool IsConnectionFromSameClient(HubLifetimeContext context) return TokenId == context.Context.GetTokenId(); } - public bool IsInvocationPermitted(HubInvocationContext context) + public bool ExistingConnectionMatches(HubInvocationContext context) { bool hubRegistered = ConnectionIds.TryGetValue(context.Hub.GetType(), out string? registeredConnectionId); bool connectionIdMatches = registeredConnectionId == context.Context.ConnectionId; @@ -76,7 +76,7 @@ public bool IsInvocationPermitted(HubInvocationContext context) return hubRegistered && connectionIdMatches; } - public bool CanCleanUpConnection(HubLifetimeContext context) + public bool ExistingConnectionMatches(HubLifetimeContext context) { bool hubRegistered = ConnectionIds.TryGetValue(context.Hub.GetType(), out string? registeredConnectionId); bool connectionIdMatches = registeredConnectionId == context.Context.ConnectionId;