[Libwebsockets] Async DNS resolver

Carlos Sánchez carlos at guadalfeo.com
Tue Jun 10 17:52:13 CEST 2014


Hi,

I'm new here and using libwebsockets library.

I've created a buildroot package for my old embedded linux system with 
the addition of small patches to achieve this. I want to use 
libwebsockets as client and server, but my first step will be as client 
and try to connect to pusher service and similar.

With latency in mind and digging into the code, I've see calls to 
gethostbyname() and other DNS family functions witch are synchronous and 
can block for long time the "loop" (I'm also using libev as event 
manager in my app) until name resolution. So my question is to know if 
will be async DNS option for future releases of the library in a similar 
fashion as CyaSSL and libev, i.e., as compile option. I'm using also a 
great library, libcurl with option to use async DNS using c-ares library 
that will be nice for libwebsockets. Probably I need to put all the 
libwebsockets client handling in a thread to handle requests, but I want 
to try first do in the "loop" and even in the thread, async DNS will be 
nice to make more responsive multiple connections.

I suppose that there are many other locking functions (like 
libwebsockets_serve_http_file()), but at the moment, this is the only 
one that I see with long time response..

Thanks in advance.. and nice job!




More information about the Libwebsockets mailing list