summaryrefslogtreecommitdiffstats
path: root/src/plugins/tlspicotls/tls_picotls.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-07-31 15:56:45 -0700
committerDave Barach <openvpp@barachs.net>2021-08-03 14:45:01 +0000
commit8f174ad5b6ab472d7ee4cba61bc5f672bd6a3fbb (patch)
treeb0766e28115cb3f28f897c8f584c9739b6ce3fb7 /src/plugins/tlspicotls/tls_picotls.c
parentbc0c754116a287f7b6c24fbd0dffd6ef04f7957b (diff)
tls: picotls handle accept failures
Should also fix coverity warning. Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I068b837377b329a22ace5b2235c6dd9f067ead77
Diffstat (limited to 'src/plugins/tlspicotls/tls_picotls.c')
-rw-r--r--src/plugins/tlspicotls/tls_picotls.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/plugins/tlspicotls/tls_picotls.c b/src/plugins/tlspicotls/tls_picotls.c
index a0fbab0495c..a0448e93338 100644
--- a/src/plugins/tlspicotls/tls_picotls.c
+++ b/src/plugins/tlspicotls/tls_picotls.c
@@ -287,9 +287,21 @@ picotls_ctx_read (tls_ctx_t *ctx, session_t *tcp_session)
{
picotls_do_handshake (ptls_ctx, tcp_session);
if (picotls_handshake_is_over (ctx))
- ret = ptls_is_server (ptls_ctx->tls) ?
- tls_notify_app_accept (ctx) :
- tls_notify_app_connected (ctx, SESSION_E_NONE);
+ {
+ if (ptls_is_server (ptls_ctx->tls))
+ {
+ if (tls_notify_app_accept (ctx))
+ {
+ ctx->c_s_index = SESSION_INVALID_INDEX;
+ tls_disconnect_transport (ctx);
+ return -1;
+ }
+ }
+ else
+ {
+ tls_notify_app_connected (ctx, SESSION_E_NONE);
+ }
+ }
if (!svm_fifo_max_dequeue (tcp_session->rx_fifo))
return 0;