[Libwebsockets] LWS_CALLBACK_CLIENT_CONNECTION_ERROR handling with external polling?

Andy Green andy at warmcat.com
Mon Jan 18 05:02:51 CET 2016



On January 17, 2016 8:53:17 AM GMT+08:00, Matt Sarnoff <matt.sarnoff at gmail.com> wrote:
>I'm currently using libwebsockets 1.6.0 in a client application with an
>external polling mechanism provided by a libuv event loop. I'm not
>calling
>lws_service() at all.
>
>I'm finding that I never receive LWS_CALLBACK_CLIENT_CONNECTION_ERROR
>for
>connection timeouts, e.g. if I specify a nonexistent host name. If I
>call
>lws_service() in a loop, I receive the callback after about 5 seconds,
>as
>expected.
>
>My current solution involves calling lws_client_connect_via_info(),
>then
>calling lws_service() periodically from a uv_timer_t
>until LWS_CALLBACK_CLIENT_ESTABLISHED is received or the connection
>fails.
>Is there a better way to handle this scenario?

The guy who added the basic libev support left a comment that somebody should implement timeouts using libev api, I guess that is what he meant.

In the service code once a second he will check everyone to see if they crossed a timeout limit.  But the libev code as you say deals with events only in the libev realm.

Can you share your existing code for this and I'll try to integrate it on the library side, just for timeout processing.

-Andy

>
>Thanks,
>-matt
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org
>http://ml.libwebsockets.org/mailman/listinfo/libwebsockets




More information about the Libwebsockets mailing list