[noPoll] nopoll_conn_new() blocking

Rami Rosenbaum rami en modularity.co.il
Lun Dic 14 10:53:59 CET 2015


Hi,
Thanks.

I downloaded the nopoll-master.
I couldn't build it - ./configure, ...
I had to copy a few files from the opl version (configure, install.sh,
Makefile.in, etc.) - what am I doing wrong?

On 12 December 2015 at 11:16, Francis Brosnan Blázquez <
francis.brosnan en aspl.es> wrote:

> El mié, 09-12-2015 a las 11:15 +0200, Rami Rosenbaum escribió:
>
> Hello,
>
>
> Hi Rami,
>
> I'm using noPoll lib in my Qt GUI application.
>
> I am using it in non-blocking mode, within my main thread, using
> timer-events and a state machine.
>
> The scenario happens on both my Ubuntu laptop and my ARM embedded Linux.
>
>
> Ok,
>
> I just noticed that when my server was down (I'm not sure what that means,
> in networking concepts) - nopoll_conn_new() blocked for its' default
> timeout (20 seconds).
>
> So
> *Question 1: is nopoll_conn_new() blocking?*
>
>
> Ok, yes and no, it is blocking with a timeout but just for sending the
> client
> init (the initial packet that a WebSocket client must send), but the
> function
> does not block the caller until a reply from the server is received and
> the
> handshake is completed,
>
> So, it essence, nopoll_conn_new (and all its variants) is not blocking
> (unless you have a problem with network connection causing send() API
> to fail to send the WebSocket init message by returning EWOULD_BLOCK,
> which is very likely to not happen),
>
> In that, the connection (noPollConn) reported by this function have big
> chances to be not ready (that's why you have to use nopoll_conn_is_ready
> or the blocking one nopoll_conn_wait_until_connection_ready to ensure
> you successfully connected),
>
> I found nopoll_conn_connect_timeout(), but it's not in the API.
>
> So I changed the timeout:
>
> m_ctx->conn_connect_std_timeout = 2 * 1000 * 1000; // 2 seconds
>
> and it worked.
>
>
> Ok, there's a function (*nopoll_conn_connect_timeout) *which is
> already implemented but wasn't on the nopoll_conn.h header.
>
> There's also a *nopoll_conn_get_connect_timeout*  that also allows
> to get current value configured...but again, it was also missing in the
> public header,
>
> Now, both are available at the nopoll_conn.h header (please checkout
> latest SVN https://github.com/asples/nopoll)
>
> *Question 2: is nopoll_conn_connect_timeout() in the API?*
>
>
> Yes it shouldn't but wasn't declared at the header,
>
>
> Anyway - I can't block my main thread, so what do you recommend?
>
>
> Ok, you can reduce to the minimum the connect timeout as you did...
>
> ..and after nopoll_conn_new finishes, use mentioned functions regularly
> to check if you did connect,
>
> Best Regards,
>
> Thanks
>
>
> _______________________________________________
> noPoll mailing listnoPoll en lists.aspl.eshttp://lists.aspl.es/cgi-bin/mailman/listinfo/nopoll
>
>
> --
> Francis Brosnan Blázquez  -  ASPLhttp://www.asplhosting.com/http://www.aspl.es/https://twitter.com/aspl_eshttps://twitter.com/asplhostinghttps://twitter.com/francisbrosnanb
>
> 91 134 14 22 - 91 134 14 45 - 91 116 07 57
>
> AVISO LEGAL
>
> En virtud de lo dispuesto en la Ley Orgánica 15/1999, de 13 de
> diciembre, de Protección de Datos de Carácter Personal, le informamos de
> que sus datos de carácter personal, recogidos de fuentes accesibles al
> público o datos que usted nos ha facilitado previamente, proceden de
> bases de datos propiedad de Advanced Software Production Line, S.L.
> (ASPL).
>
> ASPL garantiza que los datos serán tratados con la finalidad de mantener
> las oportunas relaciones comerciales o promocionales con usted o la
> entidad que usted representa. No obstante, usted puede ejercitar sus
> derechos de acceso, rectificación, cancelación y oposición dispuestos en
> la mencionada Ley Orgánica, notificándolo por escrito a ASPL -
> Protección Datos, C/Antonio Suárez 10 A-102, 28802, Alcalá de Henares
> (Madrid).
>
>
>
>
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://lists.aspl.es/pipermail/nopoll/attachments/20151214/fa0582ff/attachment.html>


Más información sobre la lista de distribución noPoll