mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Ensure all request failures are correctly handled during login
This commit is contained in:
@ -309,7 +309,7 @@ namespace osu.Game.Online.API
|
|||||||
if (IsLoggedIn) state.Value = APIState.Online;
|
if (IsLoggedIn) state.Value = APIState.Online;
|
||||||
|
|
||||||
failureCount = 0;
|
failureCount = 0;
|
||||||
return true;
|
return req.CompletionState == APIRequestCompletionState.Completed;
|
||||||
}
|
}
|
||||||
catch (HttpRequestException re)
|
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)
|
public void Queue(APIRequest request)
|
||||||
{
|
{
|
||||||
|
@ -84,7 +84,7 @@ namespace osu.Game.Online.API
|
|||||||
/// The state of this request, from an outside perspective.
|
/// The state of this request, from an outside perspective.
|
||||||
/// This is used to ensure correct notification events are fired.
|
/// This is used to ensure correct notification events are fired.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private APIRequestCompletionState completionState;
|
public APIRequestCompletionState CompletionState { get; private set; }
|
||||||
|
|
||||||
public void Perform(IAPIProvider api)
|
public void Perform(IAPIProvider api)
|
||||||
{
|
{
|
||||||
@ -127,10 +127,10 @@ namespace osu.Game.Online.API
|
|||||||
{
|
{
|
||||||
lock (completionStateLock)
|
lock (completionStateLock)
|
||||||
{
|
{
|
||||||
if (completionState != APIRequestCompletionState.Waiting)
|
if (CompletionState != APIRequestCompletionState.Waiting)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
completionState = APIRequestCompletionState.Completed;
|
CompletionState = APIRequestCompletionState.Completed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (API == null)
|
if (API == null)
|
||||||
@ -143,10 +143,10 @@ namespace osu.Game.Online.API
|
|||||||
{
|
{
|
||||||
lock (completionStateLock)
|
lock (completionStateLock)
|
||||||
{
|
{
|
||||||
if (completionState != APIRequestCompletionState.Waiting)
|
if (CompletionState != APIRequestCompletionState.Waiting)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
completionState = APIRequestCompletionState.Failed;
|
CompletionState = APIRequestCompletionState.Failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (API == null)
|
if (API == null)
|
||||||
@ -161,7 +161,7 @@ namespace osu.Game.Online.API
|
|||||||
{
|
{
|
||||||
lock (completionStateLock)
|
lock (completionStateLock)
|
||||||
{
|
{
|
||||||
if (completionState != APIRequestCompletionState.Waiting)
|
if (CompletionState != APIRequestCompletionState.Waiting)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
WebRequest?.Abort();
|
WebRequest?.Abort();
|
||||||
@ -200,7 +200,7 @@ namespace osu.Game.Online.API
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
lock (completionStateLock)
|
lock (completionStateLock)
|
||||||
return completionState == APIRequestCompletionState.Failed;
|
return CompletionState == APIRequestCompletionState.Failed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user