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