diff options
author | Florin Coras <fcoras@cisco.com> | 2019-10-21 16:07:46 -0700 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2020-04-03 22:10:22 +0000 |
commit | 00e01d3e875bb18397ff81e0f58f9b468477f473 (patch) | |
tree | 277b9ce692a465644de5d3481b42e6cce6394f46 /src/vnet/tls/tls.c | |
parent | 39aa7a5202a6a875bd6f5d341cb07f19ab0bf51e (diff) |
session: improve error reporting
Type: improvement
Change-Id: I9dd850a1ce85b0adb5136233f176117e0ee38817
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/tls/tls.c')
-rw-r--r-- | src/vnet/tls/tls.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/vnet/tls/tls.c b/src/vnet/tls/tls.c index 88ce3591bb6..7a172b88928 100644 --- a/src/vnet/tls/tls.c +++ b/src/vnet/tls/tls.c @@ -217,7 +217,7 @@ tls_notify_app_accept (tls_ctx_t * ctx) } int -tls_notify_app_connected (tls_ctx_t * ctx, u8 is_failed) +tls_notify_app_connected (tls_ctx_t * ctx, session_error_t err) { session_t *app_session; app_worker_t *app_wrk; @@ -229,7 +229,7 @@ tls_notify_app_connected (tls_ctx_t * ctx, u8 is_failed) return -1; } - if (is_failed) + if (err) goto failed; app_session = session_get (ctx->c_s_index, ctx->c_thread_index); @@ -238,12 +238,12 @@ tls_notify_app_connected (tls_ctx_t * ctx, u8 is_failed) app_session->session_type = session_type_from_proto_and_ip (TRANSPORT_PROTO_TLS, ctx->tcp_is_ip4); - if (app_worker_init_connected (app_wrk, app_session)) + if ((err = app_worker_init_connected (app_wrk, app_session))) goto failed; app_session->session_state = SESSION_STATE_CONNECTING; if (app_worker_connect_notify (app_wrk, app_session, - ctx->parent_app_api_context)) + SESSION_E_NONE, ctx->parent_app_api_context)) { TLS_DBG (1, "failed to notify app"); tls_disconnect (ctx->tls_ctx_handle, vlib_get_thread_index ()); @@ -260,7 +260,8 @@ failed: session_free (session_get (ctx->c_s_index, ctx->c_thread_index)); ctx->no_app_session = 1; tls_disconnect (ctx->tls_ctx_handle, vlib_get_thread_index ()); - return app_worker_connect_notify (app_wrk, 0, ctx->parent_app_api_context); + return app_worker_connect_notify (app_wrk, 0, err, + ctx->parent_app_api_context); } static inline void @@ -452,7 +453,7 @@ tls_app_rx_callback (session_t * tls_session) int tls_session_connected_callback (u32 tls_app_index, u32 ho_ctx_index, - session_t * tls_session, u8 is_fail) + session_t * tls_session, session_error_t err) { session_t *app_session; tls_ctx_t *ho_ctx, *ctx; @@ -460,7 +461,7 @@ tls_session_connected_callback (u32 tls_app_index, u32 ho_ctx_index, ho_ctx = tls_ctx_half_open_get (ho_ctx_index); - if (is_fail) + if (err) { app_worker_t *app_wrk; u32 api_context; @@ -470,7 +471,7 @@ tls_session_connected_callback (u32 tls_app_index, u32 ho_ctx_index, if (app_wrk) { api_context = ho_ctx->c_s_index; - app_worker_connect_notify (app_wrk, 0, api_context); + app_worker_connect_notify (app_wrk, 0, err, api_context); } tls_ctx_half_open_reader_unlock (); tls_ctx_half_open_free (ho_ctx_index); |