return 0;
}
-static int pakfire_daemon_connect(sd_event_source* s, uint64_t usec, void* data) {
- struct pakfire_daemon* daemon = data;
+static int pakfire_daemon_connect(struct pakfire_daemon* daemon) {
struct pakfire_sysinfo sysinfo = {};
struct pakfire_cpuinfo cpuinfo = {};
struct pakfire_xfer* xfer = NULL;
return r;
}
+/*
+ Called when the client is ready and we can start making connections...
+*/
+static int pakfire_daemon_ready(struct pakfire_client* client, void* data) {
+ struct pakfire_daemon* self = data;
+
+ // Connect the control connection
+ return pakfire_daemon_connect(self);
+}
+
// Currently we are not doing anything here. We just need to block SIGCHLD.
static int pakfire_daemon_SIGCHLD(sd_event_source* s, const struct signalfd_siginfo* si, void* data) {
return 0;
return r;
}
+#if 0
// Setup the reconnection timer
r = sd_event_add_time_relative(daemon->loop, &daemon->connect_timer,
- CLOCK_MONOTONIC, 0, 0, pakfire_daemon_connect, daemon);
+ CLOCK_MONOTONIC, 0, 0, pakfire_daemon_reconnect, daemon);
if (r < 0) {
ERROR(daemon->ctx, "Could not register the connection timer: %s\n", strerror(-r));
return r;
}
+#endif
// Disable the reconnection timer until we are authenticated
r = sd_event_source_set_enabled(daemon->connect_timer, SD_EVENT_OFF);
if (r < 0)
goto ERROR;
+ // Register the ready callback
+ pakfire_client_set_ready_callback(d->client, pakfire_daemon_ready, d);
+
// Create the cgroup
r = pakfire_cgroup_create(&d->cgroup, d->ctx, NULL, "pakfire-daemon", 0);
if (r < 0)