[Libwebsockets] lws_get_child()

Andy Green andy at warmcat.com
Thu Mar 30 01:59:47 CEST 2017

On 03/30/2017 07:53 AM, Joel Winarske wrote:
> Hi Andy I'm seeing something odd with connections.
> In my http client setup code I have:
> if (lws_get_child(wsi))
> return 1;
> My first incoming client POST works, the second fails as 
> lws_get_child() returns non-zero.
> What will cause lws_get_child() to return non-zero, and how do I avoid it?

Is the original child wsi actually getting deleted after the end of the 
first POST?

If it is, notice that not only should the parent point to the child, but 
child wsi must point to their parent (in child_wsi->parent). That will 
trigger removal from the parent when the child closes (in 

lws_adopt_descriptor_vhost(..., parent) takes care about that though...


> If I ignore this call, it will carry on, http client connects, data is 
> exchanged, then it get:
>     lwsws[11963]: LWS_CALLBACK_RECEIVE_CLIENT_HTTP closed it
>     lwsws[11963]: lws_remove_child_from_any_parent: failed to detach 
> from parent
> Joel
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> https://libwebsockets.org/mailman/listinfo/libwebsockets

More information about the Libwebsockets mailing list