[Libwebsockets] WSI creation

techi eth techieth at gmail.com
Tue Jan 24 08:49:28 CET 2017


Thanks for answer.

What i understand from test client code for every retry we are making
parent wsi to NULL.Is their any use of doing the same to NULL in error or
close reason provided we have  assigned the same to NULL while declaring.

On Tue, Jan 24, 2017 at 11:05 AM, Andy Green <andy at warmcat.com> wrote:

>
>
> On 01/24/2017 01:31 PM, techi eth wrote:
>
>>
>> Hi,
>>
>> I am observing scenario which I was not able to understand with WSI
>> creation.
>>
>> I have got connected with my test server & got WSI. Now if I remove
>> network then I am getting connection error followed by WSI destroy (I think
>> this is due to PING/PONG with server).On Receiving WSI destroy I am trying
>> again for connection with same context  by lws_client_connect_via_info().On
>> Every retry I am getting error & on same I am trying again for connection.
>>
>> I have observed I am getting sometime same WSI sometime different WSI.
>> Could you please give me more on handling of WSI by libwebsocket so it will
>> easy for me in handling.
>>
>>
> The wsi pointer is just a chunk of memory allocated by malloc().  If you
> allocate, then free something, the same chunk of memory is free to be
> allocated again.  So there is nothing strange or wrong about what you
> describe.
>
> The fact you care though, suggests you're trying to tell that the wsi
> changed... you should instead do what the test client does, set your outer
> copy of the wsi to NULL when it fails to connect, or closes.
>
> -Andy
>
>
>>
>> _______________________________________________
>> Libwebsockets mailing list
>> Libwebsockets at ml.libwebsockets.org
>> https://libwebsockets.org/mailman/listinfo/libwebsockets
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20170124/196de462/attachment-0002.html>


More information about the Libwebsockets mailing list