From adbda8fdc7d585bc4da027ea8d076da4c9fd0cfb Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Wed, 25 Jun 2025 09:32:00 +0000 Subject: [PATCH] client: Call an init function whenever the event loop starts Signed-off-by: Michael Tremer --- src/pakfire/client.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/pakfire/client.c b/src/pakfire/client.c index 5c2b09f3..172c8e54 100644 --- a/src/pakfire/client.c +++ b/src/pakfire/client.c @@ -220,6 +220,16 @@ static int pakfire_client_xfer_auth(struct pakfire_client* self, struct pakfire_ return 0; } +static int pakfire_client_init(sd_event_source* event, void* data) { + struct pakfire_client* self = data; + + DEBUG(self->ctx, "Initializing client...\n"); + + // XXX TODO + + return 0; +} + static void pakfire_client_free(struct pakfire_client* self) { if (self->auth.timer) sd_event_source_unref(self->auth.timer); @@ -286,6 +296,11 @@ int pakfire_client_create(struct pakfire_client** client, DEBUG(self->ctx, "Pakfire Build Service initialized for %s\n", pakfire_client_get_url(self)); + // Schedule to run the init function as soon as the event loop has started + r = sd_event_add_defer(self->loop, NULL, pakfire_client_init, self); + if (r < 0) + goto ERROR; + // Return the pointer *client = self; -- 2.47.2