diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2003-05-28 09:50:31 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2003-05-28 09:50:31 +0000 |
commit | f8b950e1163b9299c72576f88f9f98ea37a74750 (patch) | |
tree | 9e183370f50531de0aa71e3b7e47c4f7e7541aba | |
parent | d255680c53e04c8e16da5e8fae6be240aeebbbdc (diff) | |
download | gnutls-f8b950e1163b9299c72576f88f9f98ea37a74750.tar.gz |
Corrected a bug in the record layer buffering, which affected
the case where external pull function was used. Report and a patch
by Sergey Poznyakoff <gray@Mirddin.farlep.net>.
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | lib/gnutls_buffers.c | 21 |
2 files changed, 20 insertions, 6 deletions
@@ -1,3 +1,8 @@ +Version 0.8.8 +- Corrected a bug in the record layer buffering, which affected + the case where external pull function was used. Report and patch + by Sergey Poznyakoff <gray@Mirddin.farlep.net>. + Version 0.8.7 (12/05/2003) - Some corrections in the Makefiles, to prevent some build errors in solaris. diff --git a/lib/gnutls_buffers.c b/lib/gnutls_buffers.c index 11746fa3f8..fa42fb4f24 100644 --- a/lib/gnutls_buffers.c +++ b/lib/gnutls_buffers.c @@ -325,7 +325,7 @@ ssize_t _gnutls_io_read_buffered( gnutls_session session, opaque **iptr, size_t size_t min; int buf_pos; char *buf; - int recvlowat = RCVLOWAT; + int recvlowat; int recvdata, alloc_size; *iptr = session->internals.record_recv_buffer.data; @@ -335,13 +335,22 @@ ssize_t _gnutls_io_read_buffered( gnutls_session session, opaque **iptr, size_t return GNUTLS_E_INVALID_REQUEST; } - /* leave peeked data to the kernel space only if application data - * is received and we don't have any peeked - * data in gnutls session. + /* If an external pull function is used, then do not leave + * any data into the kernel buffer. */ - if ( recv_type != GNUTLS_APPLICATION_DATA - && session->internals.have_peeked_data==0) + if (session->internals._gnutls_pull_func != NULL) { recvlowat = 0; + } else { + /* leave peeked data to the kernel space only if application data + * is received and we don't have any peeked + * data in gnutls session. + */ + if ( recv_type != GNUTLS_APPLICATION_DATA + && session->internals.have_peeked_data==0) + recvlowat = 0; + else recvlowat = RCVLOWAT; + } + /* calculate the actual size, ie. get the minimum of the |