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

Reset task post-execution

This commit is contained in:
smoogipoo 2021-01-20 20:21:07 +09:00
parent e005a1cc9f
commit 6b139d4cf3

View File

@ -155,7 +155,19 @@ namespace osu.Game.Online.Multiplayer
});
}
await newTask;
try
{
await newTask;
}
finally
{
// The task will be awaited in the future, so reset it so that the user doesn't get into a permanently faulted state if anything fails.
lock (joinOrLeaveTask)
{
if (joinOrLeaveTask == newTask)
joinOrLeaveTask = null;
}
}
}
/// <summary>
@ -193,7 +205,19 @@ namespace osu.Game.Online.Multiplayer
});
}
await newTask;
try
{
await newTask;
}
finally
{
// The task will be awaited in the future, so reset it so that the user doesn't get into a permanently faulted state if anything fails.
lock (joinOrLeaveTask)
{
if (joinOrLeaveTask == newTask)
joinOrLeaveTask = null;
}
}
}
/// <summary>