[gnutls-help] gnutls_record_send says it sent more than I told it to!?

Mathieu Chouquet-Stringer m+gnutls at thi.eu.com
Wed Feb 3 22:02:28 CET 2016


On Wed, Feb 03, 2016 at 09:11:35PM +0100, Nikos Mavrogiannopoulos wrote:
> Yes. However, you must remember you had pending data already processed
> for that send() and you do not need to specify them again.

Right, just call record_send with NULL and 0.

> > But before I get this event for that specific socket, I might have 
> > done other things (aka been reading or writing from/to other TLS
> > sessions).
> 
> Could it be that the data you intended to be send have been modified?

What do you mean? Something like: is my original data buffer untouched?
Asked another way, do I have to maintain the integrity of my data
between the EAGAIN call and the NULL/0? I think I have but I'll have to
check in case I'm not supposed to touch that buffer until it's sent.

> > So the question is as follow: does gnutls keep a private buffer per
> > session (and direction, as in read buffer or write buffer) so when I
> > call gnutls_record_send with data == NULL and size == 0, it does the
> > right thing? Or can it get mixed up with other read/writes from
> > different sessions?
> 
> Sessions are totally independent; they share no state except for the
> credentials structures which are read-only.

Fair enough, thanks for clearing that out.

-- 
Mathieu Chouquet-Stringer                               m+gnutls at thi.eu.com
            The sun itself sees not till heaven clears.
	             -- William Shakespeare --



More information about the Gnutls-help mailing list