// Configuration
char keytab[PATH_MAX];
+ // Authentication
+ struct pakfire_client_auth {
+ // Timer
+ sd_event_source* timer;
+ } auth;
+
// Tokens
char access_token[1024];
time_t access_token_expires_at;
return r;
}
+static int pakfire_client_auth_timer(sd_event_source* event, uint64_t usec, void* data) {
+ struct pakfire_client* self = data;
+
+ DEBUG(self->ctx, "Authentication timer fired\n");
+
+ return 0;
+}
+
static int pakfire_client_xfer_auth(struct pakfire_client* self, struct pakfire_xfer* xfer) {
int r;
}
static void pakfire_client_free(struct pakfire_client* self) {
+ if (self->auth.timer)
+ sd_event_source_unref(self->auth.timer);
+
// Event Loop
if (self->loop)
sd_event_unref(self->loop);
if (r < 0)
goto ERROR;
+ // Setup the authentication timer
+ r = sd_event_add_time_relative(self->loop, &self->auth.timer,
+ CLOCK_MONOTONIC, 0, 0, pakfire_client_auth_timer, self);
+ if (r < 0) {
+ ERROR(self->ctx, "Could not register the auth timer: %s\n", strerror(-r));
+ goto ERROR;
+ }
+
+ // Disable the authentication timer
+ r = sd_event_source_set_enabled(self->auth.timer, SD_EVENT_OFF);
+ if (r < 0) {
+ ERROR(self->ctx, "Could not activate the auth timer: %s\n", strerror(-r));
+ goto ERROR;
+ }
+
DEBUG(self->ctx, "Pakfire Build Service initialized for %s\n",
pakfire_client_get_url(self));