gnutls_record_check_pending() broken?

Simon Josefsson simon at josefsson.org
Thu May 28 18:46:03 CEST 2009


Simon Josefsson <simon at josefsson.org> writes:

> Peter Hendrickson <pdh at wiredyne.com> 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...

Indeed, the patch below against mini.c demonstrate it working.  For me
it prints:

...
ret 1
waiting 8
...

/Simon

diff --git a/tests/mini.c b/tests/mini.c
index b64401d..a883c67 100644
--- a/tests/mini.c
+++ b/tests/mini.c
@@ -218,7 +218,12 @@ doit (void)
   ns = gnutls_record_send (server, MSG, strlen (MSG));
   success ("server: sent %d\n", ns);
 
-  ret = gnutls_record_recv (client, buffer, MAX_BUF);
+  ret = gnutls_record_recv (client, buffer, 1);
+  printf ("ret %d\n", ret);
+
+  printf ("waiting %d\n", gnutls_record_check_pending (client));
+
+  ret = gnutls_record_recv (client, buffer + 1, MAX_BUF);
   if (ret == 0)
     {
       fail ("client: Peer has closed the TLS connection\n");





More information about the Gnutls-devel mailing list