mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 19:52:55 +08:00
Actually handle case of failing to achieve lock on SemaphoreSlim
This commit is contained in:
parent
cd67fe1091
commit
c5fa818630
@ -67,7 +67,8 @@ namespace osu.Game.Online.Multiplayer
|
||||
{
|
||||
cancelExistingConnect();
|
||||
|
||||
await connectionLock.WaitAsync(10000);
|
||||
if (!await connectionLock.WaitAsync(10000))
|
||||
throw new TimeoutException("Could not obtain a lock to connect. A previous attempt is likely stuck.");
|
||||
|
||||
var builder = new HubConnectionBuilder()
|
||||
.WithUrl(endpoint, options => { options.Headers.Add("Authorization", $"Bearer {api.AccessToken}"); });
|
||||
@ -199,7 +200,10 @@ namespace osu.Game.Online.Multiplayer
|
||||
cancelExistingConnect();
|
||||
|
||||
if (takeLock)
|
||||
await connectionLock.WaitAsync(10000);
|
||||
{
|
||||
if (!await connectionLock.WaitAsync(10000))
|
||||
throw new TimeoutException("Could not obtain a lock to disconnect. A previous attempt is likely stuck.");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user