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

robustness protect and document ensure_user_space

Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
Andy Green 2013-02-15 22:31:55 +08:00
parent 099f789d2f
commit 67d556c682
2 changed files with 18 additions and 0 deletions

View file

@ -2150,9 +2150,17 @@ libwebsocket_get_reserved_bits(struct libwebsocket *wsi)
return wsi->u.ws.rsv;
}
/**
* libwebsocket_ensure_user_space(): return the user context for the connection if possible
* @wsi: websocket connection instance
*/
void *
libwebsocket_ensure_user_space(struct libwebsocket *wsi)
{
if (!wsi->protocol)
return NULL;
/* allocate the per-connection user memory (if any) */
if (wsi->protocol->per_session_data_size && !wsi->user_space) {

View file

@ -382,6 +382,16 @@ Some apis can act on all live connections of a given protocol,
this is how you can get a pointer to the active protocol if needed.
</blockquote>
<hr>
<h2>libwebsocket_ensure_user_space - </h2>
<i>void *</i>
<b>libwebsocket_ensure_user_space</b>
(<i>struct libwebsocket *</i> <b>wsi</b>)
<h3>Arguments</h3>
<dl>
<dt><b>wsi</b>
<dd>websocket connection instance
</dl>
<hr>
<h2>lws_set_log_level - Set the logging bitfield</h2>
<i>void</i>
<b>lws_set_log_level</b>