gnutls_record_check_pending() broken?

Simon Josefsson simon at
Thu May 28 18:38:12 CEST 2009

Peter Hendrickson <pdh at> writes:

> gnutls_record_check_pending() doesn't work for me.  It always returns
> 0, even when data is pending.

How did you test this?  A small code demonstrating the problem would
help.  I'll see if I can get something to work too...

Note that the function doesn't peek in the socket, it just returns
what's stored in the internal buffer.  You need to use poll or select to
check whether data is pending in the socket.

Presumably, if you set up a server that returns a large buffer, and
writes a client that reads just one byte, then the g_r_check_pending
function should return non-0.

> I followed the 2.7.11 version in the debugger and it quickly ends up
> in gnutls_buffers.c:_gnutls_record_buffer_get_size().  That function
> just returns the value kept in
> session->internals.application_data_buffer.length -- and that value
> seems to be consistently zero.  I haven't figured out what is supposed
> to be setting it.

It is typically set by, e.g., _gnutls_record_buffer_put.


More information about the Gnutls-devel mailing list