select + record_recv
Sam Varshavchik
mrsam at courier-mta.com
Sun Jul 11 14:12:04 CEST 2010
Nikos Mavrogiannopoulos writes:
> Sam Varshavchik wrote:
>> Nikos Mavrogiannopoulos writes:
>>
>>> In the early versions of GnuTLS I implemented a hack in order to use
>>> select() to check whether there are data to read from the gnutls
>>> session. Is this feature actually used? If you want to check for data in
>>> a gnutls_session how do you do it?
>>
>> I always thought that the correct logic is:
>>
>> 1) Non-blocking sockets are a must.
>>
>> 2) Check what gnutls_record_check_pending() tells you, first.
>
> So do you traverse over all gnutls sessions and use the pending function?
Yes.
>
>> 23 If there's nothing pending, poll() or select(), and if it indicates
>> that data is available, try gnutls_record_recv().
>>
>> Now, if gnutls_record_recv() hands you back some data, you do have to
>> consume it. However, this logic seems to work reliably for me, in
>> event-driven situations.
>
> Indeed this looks to be the correct approach.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: </pipermail/attachments/20100711/1391baa7/attachment.pgp>
More information about the Gnutls-help
mailing list