[gnutls-devel] Question about gnutls_record_uncork

Jaak Ristioja jaak.ristioja at cyber.ee
Mon Dec 9 13:27:14 CET 2013


Hi!

Looking at the source code of the gnutls_record_uncork function in
lib/gnutls_record.c it appears that the following might happen:

  ...
  ret = gnutls_record_send(...); /* ret >= 0 */
  ...
  total += ret;
  ...
  ret = gnutls_record_send(...); /* ret < 0 */
  ...
  return ret;

Hence, whatever was stored in the variable "total", is lost even in case
of EAGAIN when flags != GNUTLS_RECORD_WAIT. The problem here is that the
code calling gnutls_record_uncork has no way to tell how much data was
actually sent. For example:

  gnutls_record_uncork(...); /* ret == 10: have sent 10 bytes */
  gnutls_record_uncork(...); /* ret == 10: have sent 20 bytes */
  gnutls_record_uncork(...); /* ret < 0: have sent 20 + ??? bytes */
  gnutls_record_uncork(...); /* ret == 10: have sent 30 + ??? bytes */

Are there any other means to check how much pending output data TLS has
buffered? Can somebody please comment on this? Thanks!


Best regards,
Jaak



More information about the Gnutls-devel mailing list