From 57791ad4decd925bfe6c90f57ad628b1afbfcdac Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Mon, 27 Aug 2018 10:07:40 -0700 Subject: tls: fix handling of failed connects Change-Id: I48f32fdf1859420d2966dd8553f3a8f9a082e2ae Signed-off-by: Florin Coras --- src/vnet/tls/tls.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/vnet/tls') diff --git a/src/vnet/tls/tls.c b/src/vnet/tls/tls.c index 7364ba33514..b576c00d4e9 100644 --- a/src/vnet/tls/tls.c +++ b/src/vnet/tls/tls.c @@ -391,23 +391,26 @@ int tls_session_connected_callback (u32 tls_app_index, u32 ho_ctx_index, stream_session_t * tls_session, u8 is_fail) { - int (*cb_fn) (u32, u32, stream_session_t *, u8); tls_ctx_t *ho_ctx, *ctx; - app_worker_t *app_wrk; - application_t *app; u32 ctx_handle; ho_ctx = tls_ctx_half_open_get (ho_ctx_index); - app_wrk = app_worker_get (ho_ctx->parent_app_index); - app = application_get (app_wrk->app_index); - cb_fn = app->cb_fns.session_connected_callback; if (is_fail) { + int (*cb_fn) (u32, u32, stream_session_t *, u8); + u32 wrk_index, api_context; + app_worker_t *app_wrk; + application_t *app; + + wrk_index = ho_ctx->parent_app_index; + api_context = ho_ctx->c_s_index; tls_ctx_half_open_reader_unlock (); tls_ctx_half_open_free (ho_ctx_index); - return cb_fn (ho_ctx->parent_app_index, ho_ctx->c_s_index, 0, - 1 /* failed */ ); + app_wrk = app_worker_get (ho_ctx->parent_app_index); + app = application_get (app_wrk->app_index); + cb_fn = app->cb_fns.session_connected_callback; + return cb_fn (wrk_index, api_context, 0, 1 /* failed */ ); } ctx_handle = tls_ctx_alloc (ho_ctx->tls_ctx_engine); -- cgit 1.2.3-korg