MT#56374 remove DTLS timer from poller_timer

Use a dedicated looper thread instead of using the 1 Hz poller timer.

Change-Id: If63b240274121642043999725c72164240421110
pull/1692/head
Richard Fuchs 3 years ago
parent c71a3419d1
commit ac7d5e8dc3

@ -401,13 +401,13 @@ int dtls_init() {
return 0; return 0;
} }
static void __dtls_timer(void *p) { static enum thread_looper_action __dtls_timer(void) {
struct dtls_cert *c; struct dtls_cert *c;
long int left; long int left;
c = dtls_cert(); c = dtls_cert();
if (!c) if (!c)
return; return TLA_BREAK;
left = c->expires - rtpe_now.tv_sec; left = c->expires - rtpe_now.tv_sec;
if (left > CERT_EXPIRY_TIME/2) if (left > CERT_EXPIRY_TIME/2)
@ -417,10 +417,13 @@ static void __dtls_timer(void *p) {
out: out:
obj_put(c); obj_put(c);
return TLA_CONTINUE;
} }
void dtls_timer(struct poller *p) { void dtls_timer(void) {
poller_add_timer(p, __dtls_timer, NULL); 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) { static unsigned int generic_func(unsigned char *o, X509 *x, const EVP_MD *md) {

@ -1134,7 +1134,7 @@ no_kernel:
if (!rtpe_poller_map) if (!rtpe_poller_map)
die("poller map creation failed"); die("poller map creation failed");
dtls_timer(rtpe_poller); dtls_timer();
if (call_init()) if (call_init())
abort(); abort();

@ -63,7 +63,7 @@ struct dtls_connection {
int dtls_init(void); int dtls_init(void);
void dtls_timer(struct poller *); void dtls_timer(void);
int dtls_verify_cert(struct packet_stream *ps); int dtls_verify_cert(struct packet_stream *ps);
const struct dtls_hash_func *dtls_find_hash_func(const str *); const struct dtls_hash_func *dtls_find_hash_func(const str *);

Loading…
Cancel
Save