From ea8026eabfc8a7c60181b003a2091a9245b36b39 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Oto=20=C5=A0=C5=A5=C3=A1va?= Date: Mon, 22 Jul 2024 11:28:02 +0200 Subject: [PATCH] daemon/tls: proper clean up of queued protolayer contexts --- daemon/tls.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/daemon/tls.c b/daemon/tls.c index 96f036f96..173cf3c34 100644 --- a/daemon/tls.c +++ b/daemon/tls.c @@ -893,7 +893,21 @@ static int pl_tls_sess_data_deinit(struct pl_tls_sess_data *tls) tls_credentials_release(tls->server_credentials); } wire_buf_deinit(&tls->unwrap_buf); - queue_deinit(tls->unwrap_queue); /* TODO: break contexts? */ + + while (queue_len(tls->unwrap_queue) > 0) { + struct protolayer_iter_ctx *ctx = queue_head(tls->unwrap_queue); + protolayer_break(ctx, kr_error(EIO)); + queue_pop(tls->unwrap_queue); + } + queue_deinit(tls->unwrap_queue); + + while (queue_len(tls->wrap_queue)) { + struct protolayer_iter_ctx *ctx = queue_head(tls->wrap_queue); + protolayer_break(ctx, kr_error(EIO)); + queue_pop(tls->wrap_queue); + } + queue_deinit(tls->wrap_queue); + return kr_ok(); } -- 2.47.2