1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

logs: setup earlier so we can use on fail path

https://github.com/warmcat/libwebsockets/issues/2679
This commit is contained in:
Poljak181 2022-06-29 17:19:07 +01:00 committed by Andy Green
parent a723789b0e
commit 5a8f790870

View file

@ -609,6 +609,12 @@ lws_create_context(const struct lws_context_creation_info *info)
goto early_bail;
}
#if defined(LWS_WITH_SYS_STATE)
// NOTE: we need to init this fields because they may be used in logger when context destroying
context->mgr_system.state_names = system_state_names;
context->mgr_system.context = context;
#endif
#if defined(LWS_WITH_NETWORK)
context->event_loop_ops = plev->ops;
context->us_wait_resolution = us_wait_resolution;
@ -1340,11 +1346,9 @@ lws_create_context(const struct lws_context_creation_info *info)
* init the lws_state mgr for the system state
*/
context->mgr_system.state_names = system_state_names;
context->mgr_system.name = "system";
context->mgr_system.state = LWS_SYSTATE_CONTEXT_CREATED;
context->mgr_system.parent = context;
context->mgr_system.context = context;
#if defined(LWS_WITH_SYS_SMD)
context->mgr_system.smd_class = LWSSMDCL_SYSTEM_STATE;
#endif