summaryrefslogtreecommitdiffstats
path: root/src/fastd.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-11-10 20:55:47 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-11-10 20:55:47 +0100
commitc5aeb0dc4228c6396f35395194e0ec9cc91519c4 (patch)
treeff8a08aadad6c84d9042ffcc1ead169977216c01 /src/fastd.c
parent598a8acfc1c1aaefb3c7407e517cc1e0f87b753a (diff)
downloadfastd-c5aeb0dc4228c6396f35395194e0ec9cc91519c4.tar
fastd-c5aeb0dc4228c6396f35395194e0ec9cc91519c4.zip
Implement generic task queue to handle handshakes and maintenance
Diffstat (limited to 'src/fastd.c')
-rw-r--r--src/fastd.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/fastd.c b/src/fastd.c
index 8723add..603def1 100644
--- a/src/fastd.c
+++ b/src/fastd.c
@@ -503,7 +503,7 @@ static inline void init(int argc, char *argv[]) {
init_config(&status_fd);
fastd_update_time();
- ctx.next_maintenance = ctx.now + MAINTENANCE_INTERVAL;
+ fastd_task_schedule(&ctx.next_maintenance, TASK_TYPE_MAINTENANCE, ctx.now + MAINTENANCE_INTERVAL);
fastd_receive_unknown_init();
@@ -574,17 +574,6 @@ static inline void init(int argc, char *argv[]) {
}
-/** Performs periodic maintenance tasks */
-static inline void maintenance(void) {
- if (!fastd_timed_out(ctx.next_maintenance))
- return;
-
- fastd_socket_handle_binds();
- fastd_peer_maintenance();
-
- ctx.next_maintenance += MAINTENANCE_INTERVAL;
-}
-
/** Reaps zombies of asynchronous shell commands. */
static inline void reap_zombies(void) {
size_t i;
@@ -637,10 +626,9 @@ static inline void handle_signals(void) {
/** A single iteration of fastd's main loop */
static inline void run(void) {
- fastd_peer_handle_handshake_queue();
+ fastd_task_handle();
fastd_poll_handle();
- maintenance();
handle_signals();
}