[Libwebsockets] About returning -1 from callback and the pointer to the struct libwebsocket.

Armando Baños armbp1972 at gmail.com
Sat May 24 18:22:45 CEST 2014


I'm using libwebsocket as client and when I reach the point of closing
the connection I'm using the method proposed in the documentation of
returning -1 from the callback LWS_CALLBACK_CLIENT_WRITEABLE. That's
going fine but the problem is that after the return from the callback,
even when I have received the last callback (LWS_CALLBACK_CLOSED or
one of the callbacks related with POLL_FD) the pointer to the
libwebsocket struct that represents the connection never gets NULL (I
have wait even 5 minutes writting the pointer value to the syslog).

It's something wrong in what I'm doing that does not close the
connection right? or it's normal that when the internal function
"libwebsocket_close_and_free_session" ends it does not NULLs the

Any way, in case that behaviour is right, how can I know for sure that
the connection was properly closed and that the struct libwebsocket
pointed to by my wsi variable was properly freed?

waiting a positive answer:

More information about the Libwebsockets mailing list