From: Oto Šťáva Date: Mon, 22 Jul 2024 09:28:02 +0000 (+0200) Subject: daemon/tls: proper clean up of queued protolayer contexts X-Git-Tag: v6.0.8^2~1^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea8026eabfc8a7c60181b003a2091a9245b36b39;p=thirdparty%2Fknot-resolver.git daemon/tls: proper clean up of queued protolayer contexts --- 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(); }