mirror of
https://github.com/ppy/osu
synced 2025-03-20 18:08:25 +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
|
try
|
||||||
{
|
{
|
||||||
await disconnect(false);
|
|
||||||
|
|
||||||
// this token will be valid for the scope of this connection.
|
// 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.
|
// if cancelled, we can be sure that a disconnect or reconnect is handled elsewhere.
|
||||||
var cancellationToken = connectCancelSource.Token;
|
var cancellationToken = connectCancelSource.Token;
|
||||||
|
|
||||||
while (api.State.Value == APIState.Online)
|
while (api.State.Value == APIState.Online)
|
||||||
{
|
{
|
||||||
|
// ensure any previous connection was disposed.
|
||||||
|
await disconnect(false);
|
||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
Logger.Log("Multiplayer client connecting...", LoggingTarget.Network);
|
Logger.Log("Multiplayer client connecting...", LoggingTarget.Network);
|
||||||
|
Loading…
Reference in New Issue
Block a user