]> git.ipfire.org Git - pakfire.git/commitdiff
client: Automatically remove uploads from queue on free
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 25 Jun 2025 11:16:21 +0000 (11:16 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 25 Jun 2025 11:16:21 +0000 (11:16 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/client.c

index 3c3f4314f7c6d10a1291f137a68f22c1a6bba83b..e4d2c0e9b80d54fbac70efe2ad0cb214ee5462ec 100644 (file)
@@ -598,6 +598,12 @@ ERROR:
 // Uploads
 
 static void pakfire_client_upload_free(struct pakfire_client_upload* upload) {
+       struct pakfire_client* client = upload->client;
+
+       // Remove the upload from the queue (if present)
+       if (client)
+               STAILQ_REMOVE(&client->uploads, upload, pakfire_client_upload, nodes);
+
        // Close the file handle
        if (upload->f)
                fclose(upload->f);
@@ -681,10 +687,6 @@ ERROR:
        return r;
 }
 
-static void pakfire_client_upload_remove(struct pakfire_client* self, struct pakfire_client_upload* upload) {
-       STAILQ_REMOVE(&self->uploads, upload, pakfire_client_upload, nodes);
-}
-
 static int pakfire_client_upload_payload(struct pakfire_client_upload* upload) {
        struct pakfire_client* self = upload->client;
        struct pakfire_xfer* xfer = NULL;