[Libwebsockets] Quick API question

Brice Hamon normandviking at gmail.com
Mon Mar 23 20:54:07 CET 2020


Hi guys,

I have a quick question on lws usage.

Server side of the API, when I get notified of a client's connection
on LWS_CALLBACK_ESTABLISHED, the struct per_session_data is allocated by
the library, and deleted on close. I call that pointer pss.

I've been using that address to reference the client's connection on other
threads as this server is totally MT but one thread encapsulates the lws
safely. I am also using lws with external event loop support, which works
beautifully.

Of course as things happen, the client connection may be closed, therefore
the pss invalidated, while I have in flight messages in queues.

So far I have a fast hash to keep track of the validity of a pss, in the
thread managing lws. So far so good.

Now my question is: is there a way to ask lws if that pss is still active
(referenced? ), instead of me doing it externally?

I am still using the 3.0 Stable, soon to upgrade to 4.0 stable on OpenSuse
15.1.

Thank you
Brice.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20200323/251d3007/attachment.htm>


More information about the Libwebsockets mailing list