1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-30 00:00:16 +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 dcca7a514d
commit b0b4f0dd56

View file

@ -630,6 +630,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;
@ -1375,11 +1381,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