mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 13:22:55 +08:00
Ensure all request failures are correctly handled during login
This commit is contained in:
parent
b09105e5a7
commit
a6b7ca1a4c
@ -309,7 +309,7 @@ namespace osu.Game.Online.API
|
||||
if (IsLoggedIn) state.Value = APIState.Online;
|
||||
|
||||
failureCount = 0;
|
||||
return true;
|
||||
return req.CompletionState == APIRequestCompletionState.Completed;
|
||||
}
|
||||
catch (HttpRequestException re)
|
||||
{
|
||||
@ -381,7 +381,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)
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user