mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 12:17:26 +08:00
Merge pull request #27193 from bdach/fix-not-working-metadata-hub-cleanup
Fix a few issues in metadata hub's disconnection requested flow
This commit is contained in:
commit
520576a0fd
@ -13,6 +13,18 @@ namespace osu.Game.Online
|
||||
/// </summary>
|
||||
public interface IStatefulUserHubClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Invoked when the server requests a client to disconnect.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// When this request is received, the client must presume any and all further requests to the server
|
||||
/// will either fail or be ignored.
|
||||
/// This method is ONLY to be used for the purposes of:
|
||||
/// <list type="bullet">
|
||||
/// <item>actually physically disconnecting from the server,</item>
|
||||
/// <item>cleaning up / setting up any and all required local client state.</item>
|
||||
/// </list>
|
||||
/// </remarks>
|
||||
Task DisconnectRequested();
|
||||
}
|
||||
}
|
||||
|
@ -58,6 +58,7 @@ namespace osu.Game.Online.Metadata
|
||||
// https://github.com/dotnet/aspnetcore/issues/15198
|
||||
connection.On<BeatmapUpdates>(nameof(IMetadataClient.BeatmapSetsUpdated), ((IMetadataClient)this).BeatmapSetsUpdated);
|
||||
connection.On<int, UserPresence?>(nameof(IMetadataClient.UserPresenceUpdated), ((IMetadataClient)this).UserPresenceUpdated);
|
||||
connection.On(nameof(IStatefulUserHubClient.DisconnectRequested), ((IMetadataClient)this).DisconnectRequested);
|
||||
};
|
||||
|
||||
IsConnected.BindTo(connector.IsConnected);
|
||||
@ -231,7 +232,8 @@ namespace osu.Game.Online.Metadata
|
||||
public override async Task DisconnectRequested()
|
||||
{
|
||||
await base.DisconnectRequested().ConfigureAwait(false);
|
||||
await EndWatchingUserPresence().ConfigureAwait(false);
|
||||
if (connector != null)
|
||||
await connector.Disconnect().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
|
Loading…
Reference in New Issue
Block a user