tls: prealloc chunks for dtls dgram enq

Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ib25598f72f6539c07de1acee1e6049ecd28f35cc
This commit is contained in:
Florin Coras
2021-05-21 18:26:30 -07:00
committed by Dave Barach
parent 0f27339eaa
commit af073546e1
2 changed files with 5 additions and 3 deletions

View File

@ -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;

View File

@ -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);