mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 01:17:35 +09:00
More correctly handle fire-and-forget async call
This commit is contained in:
parent
91021eb8c4
commit
d27b83d678
@ -51,21 +51,25 @@ namespace osu.Game.Screens.Multi.RealtimeMultiplayer
|
|||||||
{
|
{
|
||||||
if (!connected.NewValue)
|
if (!connected.NewValue)
|
||||||
{
|
{
|
||||||
startedEvent.Set();
|
|
||||||
|
|
||||||
// messaging to the user about this disconnect will be provided by the RealtimeMatchSubScreen.
|
// messaging to the user about this disconnect will be provided by the RealtimeMatchSubScreen.
|
||||||
Schedule(PerformImmediateExit);
|
failAndBail();
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
client.ChangeState(MultiplayerUserState.Loaded);
|
client.ChangeState(MultiplayerUserState.Loaded).ContinueWith(task =>
|
||||||
|
failAndBail(task.Exception?.Message ?? "Server error"), TaskContinuationOptions.NotOnRanToCompletion);
|
||||||
|
|
||||||
if (!startedEvent.Wait(TimeSpan.FromSeconds(30)))
|
if (!startedEvent.Wait(TimeSpan.FromSeconds(30)))
|
||||||
{
|
failAndBail("Failed to start the multiplayer match in time.");
|
||||||
Logger.Log("Failed to start the multiplayer match in time.", LoggingTarget.Runtime, LogLevel.Important);
|
}
|
||||||
|
|
||||||
Schedule(PerformImmediateExit);
|
private void failAndBail(string message = null)
|
||||||
}
|
{
|
||||||
|
if (!string.IsNullOrEmpty(message))
|
||||||
|
Logger.Log(message, LoggingTarget.Runtime, LogLevel.Important);
|
||||||
|
|
||||||
|
startedEvent.Set();
|
||||||
|
Schedule(PerformImmediateExit);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onMatchStarted() => startedEvent.Set();
|
private void onMatchStarted() => startedEvent.Set();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user