From cc5851749cfd87bdf446d7be4193c758a36d2232 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 16 Dec 2023 13:14:14 -0800 Subject: [PATCH] fixes #1673 High CPU usage with TLS The aio for connections was meant to have an infinite sleep (no timeout), but was getting an initial value of zero, so we were spinning on accept. --- src/supplemental/tls/tls_common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/supplemental/tls/tls_common.c b/src/supplemental/tls/tls_common.c index d05a289dd..9c556fd52 100644 --- a/src/supplemental/tls/tls_common.c +++ b/src/supplemental/tls/tls_common.c @@ -867,6 +867,7 @@ tls_alloc(tls_conn **conn_p, nng_tls_config *cfg, nng_aio *user_aio) nni_aio_list_init(&conn->send_queue); nni_aio_list_init(&conn->recv_queue); nni_mtx_init(&conn->lock); + nni_aio_set_timeout(&conn->conn_aio, NNG_DURATION_INFINITE); nni_aio_set_timeout(&conn->tcp_send, NNG_DURATION_INFINITE); nni_aio_set_timeout(&conn->tcp_recv, NNG_DURATION_INFINITE);