]> git.ipfire.org Git - pakfire.git/commitdiff
buildservice: Setup downloader
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 17 Oct 2023 09:59:00 +0000 (09:59 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 17 Oct 2023 09:59:00 +0000 (09:59 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/buildservice.c

index 28753256b55e99e569b45220ef6d14f0ebbc08d0..096a0d92b1049b43c9beedb5ca2d540f90f11477 100644 (file)
@@ -25,6 +25,7 @@
 #include <pakfire/buildservice.h>
 #include <pakfire/config.h>
 #include <pakfire/ctx.h>
+#include <pakfire/downloader.h>
 #include <pakfire/logging.h>
 #include <pakfire/private.h>
 #include <pakfire/string.h>
@@ -35,8 +36,12 @@ struct pakfire_buildservice {
        struct pakfire_ctx* ctx;
        int nrefs;
 
+       // Configuration
        char url[PATH_MAX];
        char keytab[PATH_MAX];
+
+       // A HTTP Client
+       struct pakfire_downloader* httpclient;
 };
 
 static int pakfire_buildservice_setup(struct pakfire_buildservice* service) {
@@ -73,6 +78,11 @@ static int pakfire_buildservice_setup(struct pakfire_buildservice* service) {
        if (r)
                goto ERROR;
 
+       // Setup the downloader
+       r = pakfire_downloader_create(&service->httpclient, service->ctx);
+       if (r)
+               goto ERROR;
+
 ERROR:
        if (config)
                pakfire_config_unref(config);
@@ -81,6 +91,8 @@ ERROR:
 }
 
 static void pakfire_buildservice_free(struct pakfire_buildservice* service) {
+       if (service->httpclient)
+               pakfire_downloader_unref(service->httpclient);
        if (service->ctx)
                pakfire_ctx_unref(service->ctx);