1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:07:52 +08:00

Rename method to avoid weird code analysis rule

This commit is contained in:
Dean Herbert 2020-12-23 17:14:58 +09:00
parent 7cc38f03d1
commit 0ddcab574f
6 changed files with 8 additions and 8 deletions

View File

@ -14,7 +14,7 @@ namespace osu.Game.Extensions
/// </summary>
/// <param name="task">The task.</param>
/// <param name="logOnError">Whether errors should be logged as important, or silently ignored.</param>
public static void FireAndForget(this Task task, bool logOnError = false)
public static void CatchUnobservedExceptions(this Task task, bool logOnError = false)
{
task.ContinueWith(t =>
{

View File

@ -85,7 +85,7 @@ namespace osu.Game.Online.RealtimeMultiplayer
if (!connected.NewValue)
{
Logger.Log("Connection to multiplayer server was lost.", LoggingTarget.Runtime, LogLevel.Important);
LeaveRoom().FireAndForget();
LeaveRoom().CatchUnobservedExceptions();
}
});
}

View File

@ -106,13 +106,13 @@ namespace osu.Game.Screens.Multi.RealtimeMultiplayer.Match
return;
if (localUser.State == MultiplayerUserState.Idle)
Client.ChangeState(MultiplayerUserState.Ready).FireAndForget(true);
Client.ChangeState(MultiplayerUserState.Ready).CatchUnobservedExceptions(true);
else
{
if (Room?.Host?.Equals(localUser) == true)
Client.StartMatch().FireAndForget(true);
Client.StartMatch().CatchUnobservedExceptions(true);
else
Client.ChangeState(MultiplayerUserState.Idle).FireAndForget(true);
Client.ChangeState(MultiplayerUserState.Idle).CatchUnobservedExceptions(true);
}
}

View File

@ -177,7 +177,7 @@ namespace osu.Game.Screens.Multi.RealtimeMultiplayer.Participants
if (Room.Host?.UserID != api.LocalUser.Value.Id)
return;
Client.TransferHost(targetUser).FireAndForget(true);
Client.TransferHost(targetUser).CatchUnobservedExceptions(true);
})
};
}

View File

@ -22,7 +22,7 @@ namespace osu.Game.Screens.Multi.RealtimeMultiplayer
base.OnResuming(last);
if (client.Room != null)
client.ChangeState(MultiplayerUserState.Idle).FireAndForget(true);
client.ChangeState(MultiplayerUserState.Idle).CatchUnobservedExceptions(true);
}
protected override void UpdatePollingRate(bool isIdle)

View File

@ -70,7 +70,7 @@ namespace osu.Game.Screens.Multi.RealtimeMultiplayer
base.PartRoom();
multiplayerClient.LeaveRoom().FireAndForget();
multiplayerClient.LeaveRoom().CatchUnobservedExceptions();
// Todo: This is not the way to do this. Basically when we're the only participant and the room closes, there's no way to know if this is actually the case.
// This is delayed one frame because upon exiting the match subscreen, multiplayer updates the polling rate and messes with polling.