mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-30 00:00:16 +01:00
lws_set_wsi_user: allow setting to override existing internal allocation
This commit is contained in:
parent
af20721500
commit
ed837acda0
1 changed files with 5 additions and 8 deletions
|
@ -637,14 +637,11 @@ lws_wsi_user(struct lws *wsi)
|
||||||
void
|
void
|
||||||
lws_set_wsi_user(struct lws *wsi, void *data)
|
lws_set_wsi_user(struct lws *wsi, void *data)
|
||||||
{
|
{
|
||||||
/* client and user owns it... */
|
if (!wsi->user_space_externally_allocated && wsi->user_space)
|
||||||
if (wsi->user_space_externally_allocated ||
|
lws_free(wsi->user_space);
|
||||||
/* server, and protocol can never own it, user can control it... */
|
|
||||||
(wsi->protocol && !wsi->protocol->per_session_data_size))
|
wsi->user_space_externally_allocated = 1;
|
||||||
wsi->user_space = data;
|
wsi->user_space = data;
|
||||||
else
|
|
||||||
lwsl_err("%s: Cannot set internally-allocated user_space\n",
|
|
||||||
__func__);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct lws *
|
struct lws *
|
||||||
|
|
Loading…
Add table
Reference in a new issue