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

lws_status protect against pss list changing

This commit is contained in:
Andy Green 2016-09-09 22:15:43 +08:00
parent 9c7e84d346
commit 2083674aa0

View file

@ -148,6 +148,23 @@ callback_lws_status(struct lws *wsi, enum lws_callback_reasons reason,
if (pss->subsequent)
*p++ = ',';
pss->subsequent = 1;
m = 0;
pss2 = vhd->live_pss_list;
while (pss2) {
if (pss2 == pss->walk_next) {
m = 1;
break;
}
pss2 = pss2->next;
}
if (!m) {
/* our next guy went away */
pss->walk = WALK_FINAL;
pss->changed_partway = 1;
break;
}
lws_get_peer_simple(pss->walk_next->wsi, ip, sizeof(ip));
p += snprintf(p, end - p,
"{\"peer\":\"%s\",\"time\":\"%ld\","