aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorPing Yu <ping.yu@intel.com>2018-12-26 05:42:38 -0500
committerFlorin Coras <florin.coras@gmail.com>2019-01-03 00:16:46 +0000
commitd8e94ba8231138e86f31c745c82a0adf54531164 (patch)
tree8a914306c8644b012ac6510a166341fe01e64b0b /src/vnet
parent4a7cbcd06b3fa1f44366a606d5c148cce816503b (diff)
Fix an issue in tls.c
Curernt code will overwrite parent_app_api_context, and defer the setting after this value is used in callback. Change-Id: Ie16e432fd0f4214e6deff3aa3b58b3be824b0331 Signed-off-by: Ping Yu <ping.yu@intel.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/tls/tls.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/vnet/tls/tls.c b/src/vnet/tls/tls.c
index fdba08c5915..34de539b295 100644
--- a/src/vnet/tls/tls.c
+++ b/src/vnet/tls/tls.c
@@ -262,7 +262,6 @@ tls_notify_app_connected (tls_ctx_t * ctx, u8 is_failed)
goto failed;
ctx->app_session_handle = session_handle (app_session);
- ctx->c_s_index = app_session->session_index;
app_session->session_state = SESSION_STATE_CONNECTING;
if (cb_fn (ctx->parent_app_index, ctx->parent_app_api_context,
app_session, 0 /* not failed */ ))
@@ -272,6 +271,9 @@ tls_notify_app_connected (tls_ctx_t * ctx, u8 is_failed)
return -1;
}
+ /* parent_app_api_context should not be overwitten before used,
+ * so defer setting c_s_index */
+ ctx->c_s_index = app_session->session_index;
app_session->session_state = SESSION_STATE_READY;
session_lookup_add_connection (&ctx->connection,
session_handle (app_session));