mirror of
https://github.com/ppy/osu
synced 2025-03-25 04:18:03 +00:00
Fix connection loop always getting a cancelled token
This commit is contained in:
parent
b573c96c07
commit
4d4d97661e
@ -71,15 +71,16 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 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)
|
while (api.State.Value == APIState.Online)
|
||||||
{
|
{
|
||||||
// ensure any previous connection was disposed.
|
// ensure any previous connection was disposed.
|
||||||
|
// this will also create a new cancellation token source.
|
||||||
await disconnect(false);
|
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;
|
||||||
|
|
||||||
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