summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMole Shang <[email protected]>2023-08-10 14:40:44 +0800
committerMole Shang <[email protected]>2023-08-10 14:40:44 +0800
commit5748317e77a36b80b1459902dc6d6ad7c1634296 (patch)
tree70a007c3c0bd09e3734cfa8f32ee05fb149fe6e8
parent6cbcaba2a80c47714e8aa45d021bdcd4965780b1 (diff)
downloadhinata-5748317e77a36b80b1459902dc6d6ad7c1634296.tar.gz
hinata-5748317e77a36b80b1459902dc6d6ad7c1634296.tar.bz2
hinata-5748317e77a36b80b1459902dc6d6ad7c1634296.zip
process_url: do not run callback if corrupted
-rw-r--r--src/process_url.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/process_url.c b/src/process_url.c
index 9b1fa86..135c181 100644
--- a/src/process_url.c
+++ b/src/process_url.c
@@ -387,7 +387,6 @@ static int merge_and_cleanup(curl_conf_t **p_curl_c) {
}
append_log("Download %s finished.\n", curl_conf->outfn);
// Reset stat
- corrupted = false;
curl_c->success_thrd = 0;
curl_c->total_thrd = 0;
free_and_nullify((void **)&curl_c->URL);
@@ -544,11 +543,12 @@ void poll_status(status_t *stat) {
}
merge_and_cleanup(&curl_conf);
// Perform the callback
- if (is_empty_queue(&dl_queue) && callback_g) {
+ if (is_empty_queue(&dl_queue) && callback_g && !corrupted) {
thrd_t cb_thrd;
thrd_create(&cb_thrd, callback_g, p_callback_struct_g);
thrd_detach(cb_thrd);
}
+ corrupted = false;
}
mtx_unlock(&mtx);
}