[gnutls-help] DTLS and retransmission and reordering

Nikos Mavrogiannopoulos nmav at gnutls.org
Wed Apr 10 23:31:18 CEST 2013

On 04/10/2013 11:10 PM, Joke de Buhr wrote:

>> Your pull timeout function should return 0 on timeout, a positive number
>> if data can be received and -1 on error. I'll make the documentation
>> more clear on that, but in your case you should have returned zero
>> instead of EAGAIN.
> i see the point especially if i would use a traditional select based approach 
> while waiting for a timeout.
> but let's assume:
> the handshake timeout isn't set at all. my pull timeout function should never 
> block. 

Indeed. It should return 0 when it has no data because it is called with
a parameter of 0 ms.

> as a consequence the pull_timeout_function() will always get called with an 
> timeout value of 0. should i return 0 or set gnutls EAGAIN value and return -1 
> if no new data is available? i can't wait using select. the function can't 
> block. if data is available handshake() or receive() will be called.

The pull timeout function is set so gnutls can wait when needed. However
in your case (you use non-blocking mode) it should be called with a
parameter of 0 ms, so you should return 0 (timeout) when no data are
there. That's similar to what select does.

> now the handshake() will return a value of GNUTLS_EAGAIN and i use 

EAGAIN doesn't imply that no data are there. It merely says call me
again sometime. That's why you see no action there.


More information about the Gnutls-help mailing list