mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-09 20:41:19 +00:00
(task_decompress) Disallow same-file concurrent decompression
This commit is contained in:
parent
f84bea4302
commit
1948e6c1dd
@ -113,6 +113,16 @@ task_finished:
|
||||
free(dec);
|
||||
}
|
||||
|
||||
static bool rarch_task_decompress_finder(rarch_task_t *task, void *user_data)
|
||||
{
|
||||
decompress_state_t *dec = (decompress_state_t*)task->state;
|
||||
|
||||
if (task->handler != rarch_task_decompress_handler)
|
||||
return false;
|
||||
|
||||
return strcmp(dec->source_file, (const char*)user_data) == 0;
|
||||
}
|
||||
|
||||
bool rarch_task_push_decompress(const char *source_file, const char *target_dir,
|
||||
const char *valid_ext, rarch_task_callback_t cb, void *user_data)
|
||||
{
|
||||
@ -137,6 +147,12 @@ bool rarch_task_push_decompress(const char *source_file, const char *target_dir,
|
||||
if (!valid_ext || !valid_ext[0])
|
||||
valid_ext = NULL;
|
||||
|
||||
if (rarch_task_find(rarch_task_decompress_finder, (void*)source_file))
|
||||
{
|
||||
RARCH_LOG("[decompress] File '%s' already being decompressed.\n", source_file);
|
||||
return false;
|
||||
}
|
||||
|
||||
s = (decompress_state_t*)calloc(1, sizeof(*s));
|
||||
|
||||
s->source_file = strdup(source_file);
|
||||
|
@ -92,7 +92,7 @@ static int cb_http_conn_default(void *data_, size_t len)
|
||||
|
||||
if (!http->handle)
|
||||
{
|
||||
RARCH_ERR("Could not create new HTTP session handle.\n");
|
||||
RARCH_ERR("[http] Could not create new HTTP session handle.\n");
|
||||
http->error = true;
|
||||
return -1;
|
||||
}
|
||||
@ -218,7 +218,7 @@ bool rarch_task_push_http_transfer(const char *url, const char *type, rarch_task
|
||||
/* Concurrent download of the same file is not allowed */
|
||||
if (rarch_task_find(rarch_task_http_finder, (void*)url))
|
||||
{
|
||||
RARCH_LOG("%s is already being downloaded.\n", url);
|
||||
RARCH_LOG("[http] '%s'' is already being downloaded.\n", url);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user