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

validity: take context and pt lock before close

This commit is contained in:
Andy Green 2021-08-27 13:08:03 +01:00
parent 572e7e03e5
commit 4d81fee54f
2 changed files with 7 additions and 1 deletions

View file

@ -340,7 +340,7 @@ lws_addrinfo_clean(struct lws *wsi)
#endif
}
/* requires cx lock */
/* requires cx and pt lock */
void
__lws_close_free_wsi(struct lws *wsi, enum lws_close_status reason,

View file

@ -206,8 +206,14 @@ lws_validity_cb(lws_sorted_usec_list_t *sul)
if (wsi->validity_hup) {
lwsl_wsi_info(wsi, "validity too old");
struct lws_context_per_thread *pt = &wsi->a.context->pt[(int)wsi->tsi];
lws_context_lock(wsi->a.context, __func__);
lws_pt_lock(pt, __func__);
__lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS,
"validity timeout");
lws_pt_unlock(pt);
lws_context_unlock(wsi->a.context);
return;
}