aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/tlsopenssl/dtls_bio.c2
-rw-r--r--src/plugins/tlsopenssl/tls_openssl.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/tlsopenssl/dtls_bio.c b/src/plugins/tlsopenssl/dtls_bio.c
index 7cd2abd42e2..39e9435b7ff 100644
--- a/src/plugins/tlsopenssl/dtls_bio.c
+++ b/src/plugins/tlsopenssl/dtls_bio.c
@@ -110,7 +110,7 @@ bio_dtls_write (BIO *b, const char *in, int inl)
rv = app_send_dgram_raw (s->tx_fifo, &at, mq, (u8 *) in, inl,
SESSION_IO_EVT_TX, 1 /* do_evt */, 0 /* noblock */);
- if (rv < 0)
+ if (rv <= 0)
{
BIO_set_retry_read (b);
errno = EAGAIN;
diff --git a/src/plugins/tlsopenssl/tls_openssl.c b/src/plugins/tlsopenssl/tls_openssl.c
index 7a840f11b4a..496d777d3b3 100644
--- a/src/plugins/tlsopenssl/tls_openssl.c
+++ b/src/plugins/tlsopenssl/tls_openssl.c
@@ -422,10 +422,10 @@ openssl_ctx_write_dtls (tls_ctx_t *ctx, session_t *app_session,
{
openssl_main_t *om = &openssl_main;
openssl_ctx_t *oc = (openssl_ctx_t *) ctx;
+ u32 read = 0, to_deq, dgram_sz, enq_max;
session_dgram_pre_hdr_t hdr;
session_t *us;
int wrote, rv;
- u32 read = 0, to_deq, dgram_sz;
u8 *buf;
us = session_get_from_handle (ctx->tls_session_handle);
@@ -440,7 +440,9 @@ openssl_ctx_write_dtls (tls_ctx_t *ctx, session_t *app_session,
ASSERT (to_deq >= hdr.data_length + SESSION_CONN_HDR_LEN);
dgram_sz = hdr.data_length + SESSION_CONN_HDR_LEN;
- if (svm_fifo_max_enqueue_prod (us->tx_fifo) < dgram_sz + TLSO_CTRL_BYTES)
+ enq_max = dgram_sz + TLSO_CTRL_BYTES;
+ if (svm_fifo_max_enqueue_prod (us->tx_fifo) < enq_max ||
+ svm_fifo_provision_chunks (us->tx_fifo, 0, 0, enq_max))
{
svm_fifo_add_want_deq_ntf (us->tx_fifo, SVM_FIFO_WANT_DEQ_NOTIF);
transport_connection_deschedule (&ctx->connection);