1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-29 02:12:57 +08:00

Merge pull request #14392 from peppy/fix-login-as-guest

Ensure all request failures are correctly handled during login
This commit is contained in:
Dan Balasescu 2021-08-20 14:27:05 +09:00 committed by GitHub
commit 781a4f997f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 9 deletions

View File

@ -305,9 +305,11 @@ namespace osu.Game.Online.API
{
req.Perform(this);
if (req.CompletionState != APIRequestCompletionState.Completed)
return false;
// we could still be in initialisation, at which point we don't want to say we're Online yet.
if (IsLoggedIn) state.Value = APIState.Online;
failureCount = 0;
return true;
}
@ -381,7 +383,7 @@ namespace osu.Game.Online.API
}
}
public bool IsLoggedIn => localUser.Value.Id > 1;
public bool IsLoggedIn => localUser.Value.Id > 1; // TODO: should this also be true if attempting to connect?
public void Queue(APIRequest request)
{

View File

@ -84,7 +84,7 @@ namespace osu.Game.Online.API
/// The state of this request, from an outside perspective.
/// This is used to ensure correct notification events are fired.
/// </summary>
private APIRequestCompletionState completionState;
public APIRequestCompletionState CompletionState { get; private set; }
public void Perform(IAPIProvider api)
{
@ -127,10 +127,10 @@ namespace osu.Game.Online.API
{
lock (completionStateLock)
{
if (completionState != APIRequestCompletionState.Waiting)
if (CompletionState != APIRequestCompletionState.Waiting)
return;
completionState = APIRequestCompletionState.Completed;
CompletionState = APIRequestCompletionState.Completed;
}
if (API == null)
@ -143,10 +143,10 @@ namespace osu.Game.Online.API
{
lock (completionStateLock)
{
if (completionState != APIRequestCompletionState.Waiting)
if (CompletionState != APIRequestCompletionState.Waiting)
return;
completionState = APIRequestCompletionState.Failed;
CompletionState = APIRequestCompletionState.Failed;
}
if (API == null)
@ -161,7 +161,7 @@ namespace osu.Game.Online.API
{
lock (completionStateLock)
{
if (completionState != APIRequestCompletionState.Waiting)
if (CompletionState != APIRequestCompletionState.Waiting)
return;
WebRequest?.Abort();
@ -200,7 +200,7 @@ namespace osu.Game.Online.API
get
{
lock (completionStateLock)
return completionState == APIRequestCompletionState.Failed;
return CompletionState == APIRequestCompletionState.Failed;
}
}