mirror of
https://github.com/libretro/RetroArch
synced 2025-04-18 14:42:30 +00:00
log retry delay when automatically retrying network failure
This commit is contained in:
parent
41e25902a1
commit
da8f257323
@ -266,15 +266,6 @@ static void rcheevos_async_retry_request(retro_task_t* task)
|
|||||||
rcheevos_async_io_request* request = (rcheevos_async_io_request*)
|
rcheevos_async_io_request* request = (rcheevos_async_io_request*)
|
||||||
task->user_data;
|
task->user_data;
|
||||||
|
|
||||||
if (request->type == CHEEVOS_ASYNC_RICHPRESENCE)
|
|
||||||
{
|
|
||||||
/* this is a ping retry. discard the previous request and
|
|
||||||
* generate a new one. note the periodic task is still
|
|
||||||
* active for the requet */
|
|
||||||
rc_api_destroy_request(&request->request);
|
|
||||||
rcheevos_client_prepare_ping(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* the timer task has done its job. let it dispose itself */
|
/* the timer task has done its job. let it dispose itself */
|
||||||
task_set_finished(task, 1);
|
task_set_finished(task, 1);
|
||||||
|
|
||||||
@ -284,7 +275,7 @@ static void rcheevos_async_retry_request(retro_task_t* task)
|
|||||||
rcheevos_async_http_task_callback, request);
|
rcheevos_async_http_task_callback, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rcheevos_async_retry_request_after_delay(rcheevos_async_io_request* request)
|
static void rcheevos_async_retry_request_after_delay(rcheevos_async_io_request* request, const char* error)
|
||||||
{
|
{
|
||||||
retro_task_t* task = task_init();
|
retro_task_t* task = task_init();
|
||||||
|
|
||||||
@ -295,6 +286,9 @@ static void rcheevos_async_retry_request_after_delay(rcheevos_async_io_request*
|
|||||||
? (120 * 1000 * 1000)
|
? (120 * 1000 * 1000)
|
||||||
: ((250 * 1000) << request->attempt_count);
|
: ((250 * 1000) << request->attempt_count);
|
||||||
|
|
||||||
|
CHEEVOS_ERR(RCHEEVOS_TAG "%s %u: %s (automatic retry in %dms)\n", request->failure_message,
|
||||||
|
request->id, error, (int)retry_delay / 1000);
|
||||||
|
|
||||||
task->when = cpu_features_get_time_usec() + retry_delay;
|
task->when = cpu_features_get_time_usec() + retry_delay;
|
||||||
task->handler = rcheevos_async_retry_request;
|
task->handler = rcheevos_async_retry_request;
|
||||||
task->user_data = request;
|
task->user_data = request;
|
||||||
@ -313,11 +307,19 @@ static void rcheevos_async_http_task_callback(
|
|||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
/* there was a communication error. automatically retry the request */
|
/* there was a communication error */
|
||||||
|
if (request->type == CHEEVOS_ASYNC_RICHPRESENCE && request->attempt_count > 0)
|
||||||
|
{
|
||||||
|
/* only retry the ping once (in case of network hiccup), otherwise let
|
||||||
|
* the timer handle it after the normal ping period has elapsed */
|
||||||
CHEEVOS_ERR(RCHEEVOS_TAG "%s %u: %s\n", request->failure_message,
|
CHEEVOS_ERR(RCHEEVOS_TAG "%s %u: %s\n", request->failure_message,
|
||||||
request->id, error);
|
request->id, error);
|
||||||
|
}
|
||||||
rcheevos_async_retry_request_after_delay(request);
|
else
|
||||||
|
{
|
||||||
|
/* automatically retry the request */
|
||||||
|
rcheevos_async_retry_request_after_delay(request, error);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -485,6 +487,7 @@ static void rcheevos_async_ping_handler(retro_task_t* task)
|
|||||||
/* game changed; stop the recurring task - a new one will
|
/* game changed; stop the recurring task - a new one will
|
||||||
* be scheduled if a new game is loaded */
|
* be scheduled if a new game is loaded */
|
||||||
task_set_finished(task, 1);
|
task_set_finished(task, 1);
|
||||||
|
/* request->request was destroyed in rcheevos_async_http_task_callback */
|
||||||
free(request);
|
free(request);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -191,9 +191,13 @@ ACHIEVEMENTS
|
|||||||
#include "../network/net_http_special.c"
|
#include "../network/net_http_special.c"
|
||||||
|
|
||||||
#include "../cheevos/cheevos.c"
|
#include "../cheevos/cheevos.c"
|
||||||
|
#include "../cheevos/cheevos_client.c"
|
||||||
#include "../cheevos/cheevos_menu.c"
|
#include "../cheevos/cheevos_menu.c"
|
||||||
#include "../cheevos/cheevos_parser.c"
|
#include "../cheevos/cheevos_parser.c"
|
||||||
|
|
||||||
|
#include "../deps/rcheevos/src/rapi/rc_api_common.c"
|
||||||
|
#include "../deps/rcheevos/src/rapi/rc_api_runtime.c"
|
||||||
|
#include "../deps/rcheevos/src/rapi/rc_api_user.c"
|
||||||
#include "../deps/rcheevos/src/rcheevos/alloc.c"
|
#include "../deps/rcheevos/src/rcheevos/alloc.c"
|
||||||
#include "../deps/rcheevos/src/rcheevos/compat.c"
|
#include "../deps/rcheevos/src/rcheevos/compat.c"
|
||||||
#include "../deps/rcheevos/src/rcheevos/condition.c"
|
#include "../deps/rcheevos/src/rcheevos/condition.c"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user