From 9adc64114bbd1fbfab3c9be076333640098f683b Mon Sep 17 00:00:00 2001 From: Andy Green Date: Thu, 27 Feb 2020 19:10:29 +0000 Subject: [PATCH] lws_set_wsi_user: allow setting if protocol pss size zero --- lib/core-net/wsi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/core-net/wsi.c b/lib/core-net/wsi.c index ddf389609..953b7477b 100644 --- a/lib/core-net/wsi.c +++ b/lib/core-net/wsi.c @@ -635,7 +635,10 @@ lws_wsi_user(struct lws *wsi) void lws_set_wsi_user(struct lws *wsi, void *data) { - if (wsi->user_space_externally_allocated) + /* client and user owns it... */ + if (wsi->user_space_externally_allocated || + /* server, and protocol can never own it, user can control it... */ + (wsi->protocol && !wsi->protocol->per_session_data_size)) wsi->user_space = data; else lwsl_err("%s: Cannot set internally-allocated user_space\n",