mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
context_destroy: backport event-lib fixes from master
This commit is contained in:
parent
c930daeaa0
commit
c09386cfee
3 changed files with 13 additions and 11 deletions
|
@ -327,7 +327,7 @@ set(PACKAGE "libwebsockets")
|
|||
set(CPACK_PACKAGE_NAME "${PACKAGE}")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR "4")
|
||||
set(CPACK_PACKAGE_VERSION_MINOR "0")
|
||||
set(CPACK_PACKAGE_VERSION_PATCH "17")
|
||||
set(CPACK_PACKAGE_VERSION_PATCH "18")
|
||||
set(CPACK_PACKAGE_RELEASE 1)
|
||||
set(CPACK_GENERATOR "RPM")
|
||||
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
|
||||
|
|
|
@ -944,7 +944,9 @@ lws_context_destroy3(struct lws_context *context)
|
|||
|
||||
#if defined(LWS_WITH_NETWORK)
|
||||
|
||||
lwsl_debug("%s\n", __func__);
|
||||
context->finalize_destroy_after_internal_loops_stopped = 1;
|
||||
if (context->event_loop_ops->destroy_context2)
|
||||
context->event_loop_ops->destroy_context2(context);
|
||||
|
||||
for (n = 0; n < context->count_threads; n++) {
|
||||
struct lws_context_per_thread *pt = &context->pt[n];
|
||||
|
@ -960,9 +962,10 @@ lws_context_destroy3(struct lws_context *context)
|
|||
#if defined(LWS_WITH_CGI)
|
||||
role_ops_cgi.pt_init_destroy(context, NULL, pt, 1);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
if (context->event_loop_ops->destroy_pt)
|
||||
context->event_loop_ops->destroy_pt(context, n);
|
||||
#endif
|
||||
|
||||
#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)
|
||||
while (pt->http.ah_list)
|
||||
|
@ -1111,14 +1114,11 @@ lws_context_destroy2(struct lws_context *context)
|
|||
lws_check_deferred_free(context, 0, 1);
|
||||
#endif
|
||||
|
||||
lws_context_unlock(context); /* } context ------ */
|
||||
|
||||
#if LWS_MAX_SMP > 1
|
||||
lws_mutex_refcount_destroy(&context->mr);
|
||||
#endif
|
||||
#if defined(LWS_WITH_NETWORK)
|
||||
if (context->event_loop_ops->destroy_context2)
|
||||
if (context->event_loop_ops->destroy_context2(context)) {
|
||||
lws_context_unlock(context); /* } context ----------- */
|
||||
context->finalize_destroy_after_internal_loops_stopped = 1;
|
||||
return;
|
||||
}
|
||||
|
@ -1130,12 +1130,10 @@ lws_context_destroy2(struct lws_context *context)
|
|||
for (n = 0; n < context->count_threads; n++)
|
||||
if (context->pt[n].inside_service) {
|
||||
lwsl_debug("%p: bailing as inside service\n", __func__);
|
||||
lws_context_unlock(context); /* } context --- */
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
lws_context_unlock(context); /* } context ------------------- */
|
||||
|
||||
lws_context_destroy3(context);
|
||||
}
|
||||
|
|
|
@ -335,8 +335,10 @@ elops_destroy_pt_event(struct lws_context *context, int tsi)
|
|||
if (!pt->event_loop_foreign) {
|
||||
event_del(pt->w_sigint.event.watcher);
|
||||
event_free(pt->w_sigint.event.watcher);
|
||||
|
||||
event_base_free(pt->event.io_loop);
|
||||
event_base_loopexit(pt->event.io_loop, NULL);
|
||||
// event_base_free(pt->event.io_loop);
|
||||
// pt->event.io_loop = NULL;
|
||||
lwsl_notice("%s: set to exit loop\n", __func__);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -437,7 +439,9 @@ elops_destroy_context2_event(struct lws_context *context)
|
|||
} else
|
||||
lwsl_debug("%s: %d: everything closed OK\n", __func__, n);
|
||||
#endif
|
||||
lwsl_err("%s: event_base_free\n", __func__);
|
||||
event_base_free(pt->event.io_loop);
|
||||
pt->event.io_loop = NULL;
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue