diff --git a/daemon/dtls.c b/daemon/dtls.c index ae530c57b..3c525dc95 100644 --- a/daemon/dtls.c +++ b/daemon/dtls.c @@ -401,13 +401,13 @@ int dtls_init() { return 0; } -static void __dtls_timer(void *p) { +static enum thread_looper_action __dtls_timer(void) { struct dtls_cert *c; long int left; c = dtls_cert(); if (!c) - return; + return TLA_BREAK; left = c->expires - rtpe_now.tv_sec; if (left > CERT_EXPIRY_TIME/2) @@ -417,10 +417,13 @@ static void __dtls_timer(void *p) { out: obj_put(c); + return TLA_CONTINUE; } -void dtls_timer(struct poller *p) { - poller_add_timer(p, __dtls_timer, NULL); +void dtls_timer(void) { + thread_create_looper(__dtls_timer, rtpe_config.idle_scheduling, + rtpe_config.idle_priority, "DTLS refresh timer", + ((long long) CERT_EXPIRY_TIME / 7) * 1000000); } static unsigned int generic_func(unsigned char *o, X509 *x, const EVP_MD *md) { diff --git a/daemon/main.c b/daemon/main.c index c1bf12576..ddfbe44f3 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -1134,7 +1134,7 @@ no_kernel: if (!rtpe_poller_map) die("poller map creation failed"); - dtls_timer(rtpe_poller); + dtls_timer(); if (call_init()) abort(); diff --git a/include/dtls.h b/include/dtls.h index 3a910b29e..7d0bb3f62 100644 --- a/include/dtls.h +++ b/include/dtls.h @@ -63,7 +63,7 @@ struct dtls_connection { int dtls_init(void); -void dtls_timer(struct poller *); +void dtls_timer(void); int dtls_verify_cert(struct packet_stream *ps); const struct dtls_hash_func *dtls_find_hash_func(const str *);