mirror of
https://github.com/ppy/osu
synced 2025-03-20 01:49:41 +00:00
Move disconnect logic inside connection loop to ensure previous connection is disposed
This commit is contained in:
parent
0f09a7feb9
commit
b573c96c07
@ -71,14 +71,15 @@ namespace osu.Game.Online.Multiplayer
|
||||
|
||||
try
|
||||
{
|
||||
await disconnect(false);
|
||||
|
||||
// this token will be valid for the scope of this connection.
|
||||
// if cancelled, we can be sure that a disconnect or reconnect is handled elsewhere.
|
||||
var cancellationToken = connectCancelSource.Token;
|
||||
|
||||
while (api.State.Value == APIState.Online)
|
||||
{
|
||||
// ensure any previous connection was disposed.
|
||||
await disconnect(false);
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
Logger.Log("Multiplayer client connecting...", LoggingTarget.Network);
|
||||
|
Loading…
Reference in New Issue
Block a user