Avoid semaphore potentially getting held forever

This commit is contained in:
Dean Herbert 2021-01-25 17:17:04 +09:00
parent 994fb2667d
commit 0f09a7feb9

View File

@ -67,7 +67,7 @@ namespace osu.Game.Online.Multiplayer
{
cancelExistingConnect();
await connectionLock.WaitAsync();
await connectionLock.WaitAsync(10000);
try
{
@ -183,7 +183,7 @@ namespace osu.Game.Online.Multiplayer
cancelExistingConnect();
if (takeLock)
await connectionLock.WaitAsync();
await connectionLock.WaitAsync(10000);
try
{
@ -237,5 +237,12 @@ namespace osu.Game.Online.Multiplayer
};
return newConnection;
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
cancelExistingConnect();
}
}
}