]> git.ipfire.org Git - pakfire.git/commitdiff
httpclient: Remove the loop running check
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 26 Jun 2025 17:18:33 +0000 (17:18 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 26 Jun 2025 17:18:33 +0000 (17:18 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/httpclient.c

index e02d2f4703d407fe2ebaf09fb1a92c2801d0139a..bea8b077ba348f641431e834f67bcb62e0b509d6 100644 (file)
@@ -63,7 +63,6 @@ struct pakfire_httpclient {
 
        // Event Loop
        sd_event* loop;
-       int is_running;
        int still_running;
 
        // Timer
@@ -477,32 +476,6 @@ ERROR:
        return r;
 }
 
-static int pakfire_httpclient_exited(sd_event_source* event, void* data);
-
-static int pakfire_httpclient_started(sd_event_source* event, void* data) {
-       struct pakfire_httpclient* self = data;
-
-       DEBUG(self->ctx, "Event loop started\n");
-
-       // Mark as running
-       self->is_running = 1;
-
-       // Register an event that get's called once we exit
-       return sd_event_add_exit(self->loop, NULL, pakfire_httpclient_exited, self);
-}
-
-static int pakfire_httpclient_exited(sd_event_source* event, void* data) {
-       struct pakfire_httpclient* self = data;
-
-       DEBUG(self->ctx, "Event loop exited\n");
-
-       // Mark as not running
-       self->is_running = 0;
-
-       // Register an event so that we catch when the loop is being restarted
-       return sd_event_add_defer(self->loop, NULL, pakfire_httpclient_started, self);
-}
-
 static int pakfire_httpclient_setup_loop(struct pakfire_httpclient* self) {
        int r;
 
@@ -523,11 +496,6 @@ static int pakfire_httpclient_setup_loop(struct pakfire_httpclient* self) {
                return r;
        }
 
-       // Have something fire when the loop has started
-       r = sd_event_add_defer(self->loop, NULL, pakfire_httpclient_started, self);
-       if (r < 0)
-               return r;
-
        return 0;
 }
 
@@ -729,7 +697,7 @@ int pakfire_httpclient_enqueue(struct pakfire_httpclient* self, struct pakfire_x
        TAILQ_INSERT_TAIL(&self->xfers, e, nodes);
 
        // Launch the transfer straight away if we are running already
-       if (self->is_running)
+       if (pakfire_ctx_loop_is_running(self->ctx))
                return pakfire_httpclient_launch_one(self, e);
 
        return 0;