]> git.ipfire.org Git - pakfire.git/commitdiff
httpclient: Don't run the main loop if there are no transfers
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 13 Oct 2024 10:24:05 +0000 (10:24 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 13 Oct 2024 10:24:05 +0000 (10:24 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/httpclient.c

index 1574ac433d60d8f31bebb76f4057edf5e276da8a..5be5671df267848c4710bb7ff1eb67ac025a40c4 100644 (file)
@@ -508,6 +508,12 @@ int pakfire_httpclient_remove_xfer(struct pakfire_httpclient* client,
 int pakfire_httpclient_run(struct pakfire_httpclient* client, const char* title) {
        int r = 0;
 
+       // Cannot run without any transfers
+       if (!client->total_xfers) {
+               CTX_DEBUG(client->ctx, "Skipping running HTTP client without any transfers\n");
+               return 0;
+       }
+
        // Set the title
        r = pakfire_progress_set_title(client->progress, "%s", title);
        if (r)