1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 16:32:54 +08:00

Fix JoinRoom failing to return canceled token

As it turns out, `Task.FromCanceled` expects to receive an already
cancelled `CancellationToken`, which `CancellationToken.None` is not.
This commit is contained in:
Bartłomiej Dach 2020-12-23 17:01:01 +01:00
parent 74f0c50d82
commit 3b0bf11366

View File

@ -122,7 +122,7 @@ namespace osu.Game.Online.RealtimeMultiplayer
protected override Task<MultiplayerRoom> JoinRoom(long roomId)
{
if (!isConnected.Value)
return Task.FromCanceled<MultiplayerRoom>(CancellationToken.None);
return Task.FromCanceled<MultiplayerRoom>(new CancellationToken(true));
return connection.InvokeAsync<MultiplayerRoom>(nameof(IMultiplayerServer.JoinRoom), roomId);
}