[gnutls-help] gnutls_record_send() behavior while corked
Attila Molnar
attilamolnar at hush.com
Wed Mar 4 19:09:29 CET 2015
On 2015. 03. 04. at 7:55 AM, "Nikos Mavrogiannopoulos" <nmav at gnutls.org> wrote:
>
>On Tue, Mar 3, 2015 at 11:48 PM, Attila Molnar
><attilamolnar at hush.com> wrote:
>> Hello everyone,
>> I'd like to use the corking functionality introduced in 3.1,
>> but there is something I don't fully understand.
>> The docs for gnutls_record_send() say that when corked
>> "All queued records will be sent when gnutls_uncork() is called
>> or when the maximum record size is reached.".
>
>Thanks for bringing that up. The behavior is the one that you
>noticed,
>but the docs were wrong. They were corrected in:
>https://gitorious.org/gnutls/gnutls/commit/f38fe7744d6ff7560c3ee67e
>3bd35b301734385a
>but for some reasons that wasn't propagated to the documentation
>generated for the web site. I'll have to check why is that.
>
>> Which one is it? Is it correct to assume that while corked,
>> gnutls_record_send() simply copies the data into an internal
>> buffer and the gnutls_record_uncork() function does something
>> equivalent to what gnutls_record_send() does when not corked,
>> but operates on all of the data given to it earlier?
>
>Correct.
Thanks for the clarification.
I assume when corked the return value of gnutls_record_send() can still
be an error, for example out of memory.
A situation can occur when gnutls_record_uncork() cannot send some
of the data, returns with GNUTLS_E_AGAIN, and next time when the
socket becomes writable the application has no new data to send, but
wants to flush the buffers.
To do this my first idea is to cork and then uncork without calling
gnutls_record_send(). Is this the best way?
Regards, Attila
More information about the Gnutls-help
mailing list