mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Move disconnect logic inside connection loop to ensure previous connection is disposed
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user