From: Michael Tremer Date: Wed, 25 Jun 2025 15:39:17 +0000 (+0000) Subject: client: Use the context's event loop X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a41fb926bf15514afd4ec5624bd7a8d9dc29910a;p=pakfire.git client: Use the context's event loop Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/client.c b/src/pakfire/client.c index 7da899fe..2d79ace4 100644 --- a/src/pakfire/client.c +++ b/src/pakfire/client.c @@ -471,7 +471,7 @@ static void pakfire_client_free(struct pakfire_client* self) { } int pakfire_client_create(struct pakfire_client** client, - struct pakfire_ctx* ctx, sd_event* loop, const char* url, const char* principal) { + struct pakfire_ctx* ctx, const char* url, const char* principal) { struct pakfire_client* self = NULL; char hostname[HOST_NAME_MAX]; int r; @@ -487,13 +487,15 @@ int pakfire_client_create(struct pakfire_client** client, // Initialize the reference counter self->nrefs = 1; - // Create a new HTTP client - r = pakfire_httpclient_create(&self->httpclient, self->ctx, loop); + // Event Loop + r = pakfire_ctx_loop(self->ctx, &self->loop); if (r < 0) goto ERROR; - // Store a reference to the event loop - self->loop = pakfire_httpclient_get_loop(self->httpclient); + // Create a new HTTP client + r = pakfire_httpclient_create(&self->httpclient, self->ctx, NULL); + if (r < 0) + goto ERROR; // Store the URL r = pakfire_string_set(self->url, url); diff --git a/src/pakfire/client.h b/src/pakfire/client.h index 0b9a488b..0fc9b16d 100644 --- a/src/pakfire/client.h +++ b/src/pakfire/client.h @@ -24,12 +24,11 @@ struct pakfire_client; #include -#include #include int pakfire_client_create(struct pakfire_client** client, - struct pakfire_ctx* ctx, sd_event* loop, const char* url, const char* principal); + struct pakfire_ctx* ctx, const char* url, const char* principal); struct pakfire_client* pakfire_client_ref(struct pakfire_client* client); struct pakfire_client* pakfire_client_unref(struct pakfire_client* client);