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

fix zombie sul detection

The cmake define isn't exported, and msvc objects to void * comparision to
non void *.

Also dump the callback pointer with any errors, since after looking it up
in your mapfile this is usually enough to understand which sul and when it
was set.
This commit is contained in:
casey 2020-10-09 16:35:44 -04:00 committed by Andy Green
parent 03a8fff42a
commit c50100cb46
2 changed files with 12 additions and 3 deletions

View file

@ -179,6 +179,7 @@
#cmakedefine LWS_WITH_STATS
#cmakedefine LWS_WITH_STRUCT_SQLITE3
#cmakedefine LWS_WITH_STRUCT_JSON
#cmakedefine LWS_WITH_SUL_DEBUGGING
#cmakedefine LWS_WITH_SQLITE3
#cmakedefine LWS_WITH_SYS_NTPCLIENT
#cmakedefine LWS_WITH_SYS_DHCP_CLIENT

View file

@ -337,10 +337,12 @@ lws_sul_debug_zombies(struct lws_context *ctx, void *po, size_t len,
* indicated as being deleted?
*/
if (sul >= po && lws_ptr_diff(sul, po) < len) {
if ((void *)sul >= po &&
(size_t)lws_ptr_diff(sul, po) < len) {
lwsl_err("%s: ERROR: Zombie Sul "
"(on list %d) %s\n", __func__,
m, destroy_description);
"(on list %d) %s, cb %p\n",
__func__, m,
destroy_description, sul->cb);
/*
* This assert fires if you have left
* a sul scheduled to fire later, but
@ -350,6 +352,12 @@ lws_sul_debug_zombies(struct lws_context *ctx, void *po, size_t len,
* that may be scheduled before
* destroying the object the sul lives
* inside.
*
* You can look up the cb pointer in
* your mapfile to find out which
* callback function the sul was using
* which usually tells you which sul
* it is.
*/
assert(0);
}