if (read <= 0)
return 0;
- if (read == enq_now)
+ c = svm_fifo_tail_chunk (f);
+ while ((c = c->next) && read < enq_max)
{
- c = svm_fifo_tail_chunk (f);
- while (read < enq_max)
- {
- c = c->next;
- enq_now = clib_min (c->length, enq_max - read);
- rv = BIO_read (bio, c->data, enq_now);
- read += rv > 0 ? rv : 0;
+ enq_now = clib_min (c->length, enq_max - read);
+ rv = BIO_read (bio, c->data, enq_now);
+ read += rv > 0 ? rv : 0;
- if (rv < enq_now)
- break;
- }
+ if (rv < enq_now)
+ break;
}
svm_fifo_enqueue_nocopy (f, read);
if (read <= 0)
return 0;
- if (read == enq_now)
+ c = svm_fifo_tail_chunk (f);
+ while ((c = c->next) && read < enq_max)
{
- c = svm_fifo_tail_chunk (f);
- while (read < enq_max)
- {
- c = c->next;
- if (!c)
- break;
- enq_now = clib_min (c->length, enq_max - read);
- rv = SSL_read (ssl, c->data, enq_now);
- read += rv > 0 ? rv : 0;
-
- if (rv < enq_now)
- break;
- }
+ enq_now = clib_min (c->length, enq_max - read);
+ rv = SSL_read (ssl, c->data, enq_now);
+ read += rv > 0 ? rv : 0;
+
+ if (rv < enq_now)
+ break;
}
svm_fifo_enqueue_nocopy (f, read);
int wrote, rv;
u32 deq_now;
- svm_fifo_fill_chunk_list (f);
-
deq_now = clib_min (svm_fifo_max_read_chunk (f), len);
wrote = BIO_write (bio, svm_fifo_head (f), deq_now);
if (wrote <= 0)
return 0;
- if (wrote == deq_now)
+ c = svm_fifo_head_chunk (f);
+ while ((c = c->next) && wrote < len)
{
- c = svm_fifo_head_chunk (f);
- while (wrote < len)
- {
- c = c->next;
- deq_now = clib_min (c->length, len - wrote);
- rv = BIO_write (bio, c->data, deq_now);
- wrote += rv > 0 ? rv : 0;
+ deq_now = clib_min (c->length, len - wrote);
+ rv = BIO_write (bio, c->data, deq_now);
+ wrote += rv > 0 ? rv : 0;
- if (rv < deq_now)
- break;
- }
+ if (rv < deq_now)
+ break;
}
svm_fifo_dequeue_drop (f, wrote);
int wrote = 0, rv;
u32 deq_now;
- svm_fifo_fill_chunk_list (f);
-
deq_now = clib_min (svm_fifo_max_read_chunk (f), len);
wrote = SSL_write (ssl, svm_fifo_head (f), deq_now);
if (wrote <= 0)
return 0;
- if (wrote == deq_now)
+ c = svm_fifo_head_chunk (f);
+ while ((c = c->next) && wrote < len)
{
- c = svm_fifo_head_chunk (f);
- while (wrote < len)
- {
- c = c->next;
- deq_now = clib_min (c->length, len - wrote);
- rv = SSL_write (ssl, c->data, deq_now);
- wrote += rv > 0 ? rv : 0;
+ deq_now = clib_min (c->length, len - wrote);
+ rv = SSL_write (ssl, c->data, deq_now);
+ wrote += rv > 0 ? rv : 0;
- if (rv < deq_now)
- break;
- }
+ if (rv < deq_now)
+ break;
}
svm_fifo_dequeue_drop (f, wrote);
openssl_ctx_write (tls_ctx_t * ctx, session_t * app_session)
{
openssl_ctx_t *oc = (openssl_ctx_t *) ctx;
- int wrote = 0, read, max_buf = 100 * TLS_CHUNK_SIZE, max_space;
+ int wrote = 0, read, max_buf = 4 * TLS_CHUNK_SIZE, max_space;
u32 deq_max, to_write;
session_t *tls_session;
svm_fifo_t *f;
static inline int
openssl_ctx_read (tls_ctx_t * ctx, session_t * tls_session)
{
- int read, wrote = 0, max_space, max_buf = 100 * TLS_CHUNK_SIZE;
+ int read, wrote = 0, max_space, max_buf = 4 * TLS_CHUNK_SIZE;
openssl_ctx_t *oc = (openssl_ctx_t *) ctx;
u32 deq_max, to_write;
session_t *app_session;