[Libwebsockets] How to properly handle LWS_CALLBACK_CLIENT_CONNECTION_ERROR?

Alfred Sawaya alfred at huji.fr
Wed Jun 27 16:24:24 CEST 2018


Hello Duane,

A memory leak has been corrected in the v3.0 branch. It happens exactly in
your case (when a websocket fails to upgrade), can you try this version ?
https://github.com/warmcat/libwebsockets/commit/3f7ffeddac34e85c5c000c687dbdbd204e74b376

Thank you,
Alfred

Le mer. 27 juin 2018 à 16:18, Duane Butler <Duane.Butler at calix.com> a
écrit :

> Using libwebsockets version 2.4.1
>
>
>
> My application creates a context (lws_create_context) and a socket
> (lws_client_connect_via_info).
>
>
>
> When the connection fails (or is closed by the other end), I want to retry
> again after a random timeout.
>
>
>
> What is the proper way to code this?
>
>
>
> Currently, I’ve tried the following:
>
>    - Call lws_client_connection_via_info again (reusing existing context)
>    - Call lws_context_destroy and start over
>
>
>
> These methods work, but result in a memory leak. I have a situation where
> I cannot connect for a couple days and the memory leak becomes significant.
>
>
>
> Thanks in advance for the help.
>
>
>
> Duane.
>
>
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> https://libwebsockets.org/mailman/listinfo/libwebsockets
>
-- 
Cordialement,
Alfred Sawaya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20180627/a3e52f41/attachment-0002.html>


More information about the Libwebsockets mailing list