[gnutls-devel] Question regarding gnutls_record_set_timeout()

Nikos Mavrogiannopoulos nmav at gnutls.org
Fri Sep 18 13:06:49 CEST 2015


On Thu, Sep 17, 2015 at 4:52 PM, Tim Ruehsen <tim.ruehsen at gmx.de> wrote:
> On Thursday 17 September 2015 14:53:06 Nikos Mavrogiannopoulos wrote:
>> On Wed, Sep 16, 2015 at 4:57 PM, Tim Ruehsen <tim.ruehsen at gmx.de> wrote:
>> > Hi,
>> > I would like to use gnutls_record_set_timeout() instead of using my own
>> > timeout code.
>> > I see no way to specify an 'indefinite' timeout, e.g. by using a negative
>> > value. Should I set the fd to blocking or what is the best 'gnutls' way ?
>>
>> The timeout for this function only makes sense with blocking fds. For
>> non-blocking fds you always have the function return as soon as
>> possible. By not setting a timeout with this function you get the
>> indefinite timeout. Does this answer your question?
> Just a slight correction.
> I use gnutls_record_set_timeout() / gnutls_record_recv() together with non-
> blocking sockets. And it works flawlessly since the timeout just adds a
> select() before the read().  If you take a blocking fd, you might experience a select() saying 'yo man,
> it's readable' and the subsequent read() being stuck. At least I experienced
> this a long time ago and since than I never used blocking fds any more :-)
> (but this is beyond discussion here, I guess).

Ok that's a use case I was not aware of... It would be then useful to
have an indicator for indefinite time. Please add an issue on the
issue tracker so I don't forget before 3.5.0.

regards,
Nikos



More information about the Gnutls-devel mailing list