gnutls_record_check_pending() broken?

Peter Hendrickson pdh at
Thu May 28 21:02:55 CEST 2009

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.

> So I don't see a problem here actually.  It sounds as if you should use
> poll/select to check if there is data pending to be read from the
> socket.  When that is true, you should call gnutls_record_recv.

I needed to do that anyway, so no great loss. ;-)


More information about the Gnutls-devel mailing list