gnutls_record_check_pending() broken?

Simon Josefsson simon at josefsson.org
Thu May 28 22:18:58 CEST 2009


Peter Hendrickson <pdh at wiredyne.com> writes:

> Simon writes:
>> That won't work: the purpose of gnutls_record_check_pending() is to
>> check if there is data stored in buffers within GnuTLS.  Before you
>> call gnutls_record_recv, there won't be any data in the buffers.
>> After a call to gnutls_record_recv, the data that was not returned
>> to the caller of the function will be stored in an internal buffer.
>> The purpose of the function is to find out if there is such data
>> pending.
>
> Okay, that makes sense to me.  This should be elaborated upon in the
> documentation because the obvious use for this function is to ask "if
> I run gnutls_record_recv() will it block?" which is apparently not
> what it does.

It can be used for that -- gnutls_record_recv will never invoke the pull
function (and thus will never block) if you call it with a sizeofdata
parameter less/equal to what gnutls_record_check_pending has just
returned.

/Simon





More information about the Gnutls-devel mailing list