[Libwebsockets] how to "close" wsi created by lws_adopt_descriptor_vhost

Andy Green andy at warmcat.com
Wed Oct 11 09:58:34 CEST 2017


Basically set a timout of -1 on it using lws_set_timeout().

On master / 2.4-to-be there are constants for this, including LWS_TO_CALL_SYNC to call the close before returning from lws_set_timeout(), if you know the wsi you are closing is not the subject of the current service.

https://github.com/warmcat/libwebsockets/blob/master/lib/libwebsockets.h#L3932

-Andy

On October 11, 2017 1:41:39 PM GMT+08:00, Per Bothner <per at bothner.com> wrote:
>After creating outwsi thus:
>   outwsi =lws_adopt_descriptor_vhost(vhost, 0, fd, "pty", NULL);
>how do we "close" outwsi when fd is closed?
>
>Specifically, after close(fd) I need for delete_from_fd(context, fd) to
>happen,
>otherwise a later lws_adopt_descriptor_vhost that reuses the fd will
>fail
>when calling insert_wsi.  However, delete_from_fd is private, and I
>haven't found
>any corresponding public API.



More information about the Libwebsockets mailing list