mirror of
https://github.com/osukey/osukey.git
synced 2025-06-22 19:57:56 +09: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();
|
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()
|
var builder = new HubConnectionBuilder()
|
||||||
.WithUrl(endpoint, options => { options.Headers.Add("Authorization", $"Bearer {api.AccessToken}"); });
|
.WithUrl(endpoint, options => { options.Headers.Add("Authorization", $"Bearer {api.AccessToken}"); });
|
||||||
@ -199,7 +200,10 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
cancelExistingConnect();
|
cancelExistingConnect();
|
||||||
|
|
||||||
if (takeLock)
|
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
|
try
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user