#include <json.h>
+#include <systemd/sd-event.h>
+
#include <pakfire/client.h>
#include <pakfire/config.h>
#include <pakfire/ctx.h>
struct pakfire_ctx* ctx;
int nrefs;
+ // Event Loop
+ sd_event* loop;
+
// HTTP Client
struct pakfire_httpclient* httpclient;
}
static void pakfire_client_free(struct pakfire_client* self) {
+ // Event Loop
+ if (self->loop)
+ sd_event_unref(self->loop);
+
if (self->httpclient)
pakfire_httpclient_unref(self->httpclient);
if (self->ctx)
// Initialize the reference counter
self->nrefs = 1;
+ // Store a reference to the event loop
+ self->loop = sd_event_ref(loop);
+
// Create a new HTTP client
- r = pakfire_httpclient_create(&self->httpclient, self->ctx, loop);
+ r = pakfire_httpclient_create(&self->httpclient, self->ctx, self->loop);
if (r < 0)
goto ERROR;