diff --git a/lib/core-net/private.h b/lib/core-net/private.h index e51010d84..123e3a04a 100644 --- a/lib/core-net/private.h +++ b/lib/core-net/private.h @@ -1039,6 +1039,9 @@ lws_same_vh_protocol_insert(struct lws *wsi, int n); int lws_pt_do_pending_sequencer_events(struct lws_context_per_thread *pt); +void +lws_sequencer_destroy_all_on_pt(struct lws_context_per_thread *pt); + LWS_EXTERN int lws_broadcast(struct lws_context *context, int reason, void *in, size_t len); diff --git a/lib/core-net/sequencer.c b/lib/core-net/sequencer.c index b277ce877..713783c3c 100644 --- a/lib/core-net/sequencer.c +++ b/lib/core-net/sequencer.c @@ -127,6 +127,19 @@ lws_sequencer_destroy(lws_sequencer_t **pseq) lws_free_set_NULL(seq); } +void +lws_sequencer_destroy_all_on_pt(struct lws_context_per_thread *pt) +{ + lws_start_foreach_dll_safe(struct lws_dll2 *, p, tp, + pt->seq_owner.head) { + lws_sequencer_t *s = lws_container_of(p, lws_sequencer_t, + seq_list); + + lws_sequencer_destroy(&s); + + } lws_end_foreach_dll_safe(p, tp); +} + int lws_sequencer_event(lws_sequencer_t *seq, lws_seq_events_t e, void *data) { diff --git a/lib/core/context.c b/lib/core/context.c index d9518806f..31df3e616 100644 --- a/lib/core/context.c +++ b/lib/core/context.c @@ -550,9 +550,9 @@ lws_context_destroy3(struct lws_context *context) lwsl_debug("%s\n", __func__); for (n = 0; n < context->count_threads; n++) { -#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2) struct lws_context_per_thread *pt = &context->pt[n]; -#endif + + lws_sequencer_destroy_all_on_pt(pt); if (context->event_loop_ops->destroy_pt) context->event_loop_ops->destroy_pt(context, n);