From: Michael Tremer Date: Wed, 25 Jun 2025 15:51:29 +0000 (+0000) Subject: daemon: Drop all sorts of timers and what not X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ccc532c4a0ddcc87508f54649099f21bb1285b5;p=pakfire.git daemon: Drop all sorts of timers and what not Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/daemon.c b/src/pakfire/daemon.c index 3ba57a6e..d425d279 100644 --- a/src/pakfire/daemon.c +++ b/src/pakfire/daemon.c @@ -69,13 +69,6 @@ struct pakfire_daemon { sd_bus* bus; int inhibitfd; - // The control connection - struct pakfire_xfer* control; - - // Connection Timer and Holdoff Time - sd_event_source* connect_timer; - unsigned int reconnect_holdoff; - // cgroup struct pakfire_cgroup* cgroup; @@ -587,6 +580,7 @@ int pakfire_daemon_stream_logs(struct pakfire_daemon* self) { unsigned int lines; int r; +#if 0 // Bail if we don't have a control connection if (!self->control) return 0; @@ -594,6 +588,7 @@ int pakfire_daemon_stream_logs(struct pakfire_daemon* self) { // Bail if the connection isn't ready to send else if (!pakfire_xfer_is_ready_to_send(self->control)) return 0; +#endif do { // Reset lines @@ -793,38 +788,6 @@ static int pakfire_daemon_setup_loop(struct pakfire_daemon* daemon) { 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_reconnect, daemon); - if (r < 0) { - ERROR(daemon->ctx, "Could not register the connection timer: %s\n", strerror(-r)); - return r; - } - - // Disable the reconnection timer until we are authenticated - r = sd_event_source_set_enabled(daemon->connect_timer, SD_EVENT_OFF); - if (r < 0) { - ERROR(daemon->ctx, "Could not disable the connection timer: %s\n", strerror(-r)); - return r; - } - - // Setup the stats timer - r = sd_event_add_time_relative(daemon->loop, &daemon->stats_timer, - CLOCK_MONOTONIC, 0, 0, pakfire_daemon_submit_stats, daemon); - if (r < 0) { - ERROR(daemon->ctx, "Could not register the stat timer: %s\n", strerror(-r)); - return r; - } - - // Disable sending stats until we are connected - r = sd_event_source_set_enabled(daemon->stats_timer, SD_EVENT_OFF); - if (r < 0) { - ERROR(daemon->ctx, "Could not disable the stats timer: %s\n", strerror(-r)); - return r; - } -#endif - return 0; } @@ -862,16 +825,12 @@ static void pakfire_daemon_free(struct pakfire_daemon* daemon) { if (daemon->builder) pakfire_builder_unref(daemon->builder); - if (daemon->connect_timer) - sd_event_source_unref(daemon->connect_timer); if (daemon->httpclient) pakfire_httpclient_unref(daemon->httpclient); if (daemon->client) pakfire_client_unref(daemon->client); if (daemon->cgroup) pakfire_cgroup_unref(daemon->cgroup); - if (daemon->control) - pakfire_xfer_unref(daemon->control); if (daemon->loop) sd_event_unref(daemon->loop); if (daemon->bus) @@ -1040,9 +999,11 @@ int pakfire_daemon_send_message(struct pakfire_daemon* self, struct json_object* size_t length = 0; int r; +#if 0 // Return an error if we are not connected if (!self->control) return -ENOTCONN; +#endif // Serialize to string m = json_object_to_json_string_length(message, @@ -1052,6 +1013,7 @@ int pakfire_daemon_send_message(struct pakfire_daemon* self, struct json_object* return -errno; } +#if 0 // Send the message r = pakfire_xfer_send_message(self->control, m, length); if (r < 0) { @@ -1064,6 +1026,7 @@ int pakfire_daemon_send_message(struct pakfire_daemon* self, struct json_object* return r; } } +#endif return 0; }