[gnutls-help] Regression bug between 2.x and 3.2?

Nikos Mavrogiannopoulos nmav at gnutls.org
Wed Jun 18 10:11:39 CEST 2014


On Tue, Jun 17, 2014 at 3:45 PM, Lavrentiev, Anton (NIH/NLM/NCBI) [C]
<lavr at ncbi.nlm.nih.gov> wrote:
>> as there are more cases where GNUTLS_E_AGAIN doesn't directly map to EAGAIN errno.
> Studying the current GNUTLS source, it looks like the added case is for exactly short writes,
> which errno_to_gerr() supports.  The other place is for short read, but since the pull
> callback is wrapped into the "while (left > 0)" loop (gnutls_stream_read), it is a legitimate
> case, which also maps correctly.  I still can't understand why the similar loop "while (left > 0)"
> was dropped off gnutls_io_write_flush (formerly part of gnutls_io_write_buffered) between 2.x and 3.x.
> Anyhow, I'm going to modify our push callback behavior to do a tight loop around the former
> push callback.  Doing so I notice that reading and writing are no longer symmetrical:
> the pull callback does not require the looping on short reads as it will be done by GNUTLS,
> and the push callback requires the looping because GNUTLS now bails out on short writes.

I believe the reason was, that if there was a short send(), that is
equivalent to try again (EAGAIN), or the underlying layer would have
to block to send the rest. Thus it looked more efficient to return
GNUTLS_E_AGAIN rather than retrying, and making immediately after the
short send() a new system call that would fail with EAGAIN.

regards,
Nikos



More information about the Gnutls-help mailing list