From a14035c60ac9c9ba08d26ad862e7a0ea8bb0ac7d 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..4e633022c 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);