Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
return sd_event_ref(daemon->loop);
}
+struct pakfire_httpclient* pakfire_daemon_httpclient(struct pakfire_daemon* daemon) {
+ return pakfire_httpclient_ref(daemon->client);
+}
+
int pakfire_daemon_main(struct pakfire_daemon* daemon) {
int r;
struct pakfire_daemon* pakfire_daemon_unref(struct pakfire_daemon* daemon);
sd_event* pakfire_daemon_loop(struct pakfire_daemon* daemon);
+struct pakfire_httpclient* pakfire_daemon_httpclient(struct pakfire_daemon* daemon);
int pakfire_daemon_main(struct pakfire_daemon* daemon);
// Event Loop
sd_event* loop;
+ // HTTP Client
+ struct pakfire_httpclient* client;
+
uuid_t job_id;
char name[NAME_MAX];
}
static void pakfire_worker_free(struct pakfire_worker* worker) {
+ if (worker->client)
+ pakfire_httpclient_unref(worker->client);
if (worker->loop)
sd_event_unref(worker->loop);
if (worker->daemon)
goto ERROR;
}
+ // Fetch a reference to the HTTP client
+ w->client = pakfire_daemon_httpclient(daemon);
+ if (!w->client) {
+ CTX_ERROR(w->ctx, "Could not fetch the HTTP client: %m\n");
+ r = -errno;
+ goto ERROR;
+ }
+
// Initialize the PID file descriptor
w->pidfd = -1;