[gnutls-help] Truly non-blocking example of gnutls usage

Nikos Mavrogiannopoulos nmav at gnutls.org
Thu Apr 14 11:09:47 CEST 2016


On Thu, Apr 14, 2016 at 11:00 AM, Alex Bligh <alex at alex.org.uk> wrote:

> I agree. But determining whether poll / ppoll etc. is available
> is a pain, and in this instance there are only two FDs. I
> can't remember how prevalent poll is (as opposed to ppoll);
> perhaps I convert it to use poll().

Note that the limitation of select is on the actual fd value, not on
the number of fds. I happened to have a select() call with 2 input fds
and had occasional crashes to my program. The culprit was that overall
the program had many open fds and this particular code although it was
using 2 fds, they often happened to be over 1024.

Note that this is not really about your example. I just wanted to rant
about it :) After my experience I've already convinced the manpages
maintainer to add a strong language against select() early in the man
page.

>> You could further simplify the example by using
>> gnutls_certificate_verification_status_print() instead of checking
>> statuses manually (that would introduce dependency to gnutls over
>> 3.1.4, but it is future proof with regards to message reporting).
> Again I agree, but I wanted this to compile on LTS Ubuntu
> (currently 14.04) which ships with 2.12.23-12ubuntu2.4 (unfortunately).

ouch.

regards,
Nikos



More information about the Gnutls-help mailing list