summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjiangxiaoming <jiangxiaoming@outlook.com>2020-09-23 10:29:21 +0800
committerxm j <jiangxiaoming@outlook.com>2020-09-23 04:45:49 +0000
commit5b7ea9122e5d9efc632633909933347c98cf3bfc (patch)
treeede7dec744d7f7e332173d0725cfa577983c29bd
parentae0d46ee6f26ec0ce714720102dce37364d0dee7 (diff)
tls: fix session format assert crash in connected callback
Type: fix Signed-off-by: jiangxiaoming <jiangxiaoming@outlook.com> Change-Id: I61b7988bf6a49a51041bc6085d5f0f4689ff45a6
-rw-r--r--src/vnet/tls/tls.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/vnet/tls/tls.c b/src/vnet/tls/tls.c
index c9509b7080d..9caa5d78d8c 100644
--- a/src/vnet/tls/tls.c
+++ b/src/vnet/tls/tls.c
@@ -232,17 +232,17 @@ tls_notify_app_connected (tls_ctx_t * ctx, session_error_t err)
if ((err = app_worker_init_connected (app_wrk, app_session)))
goto failed;
- app_session->session_state = SESSION_STATE_CONNECTING;
+ app_session->session_state = SESSION_STATE_READY;
if (app_worker_connect_notify (app_wrk, app_session,
SESSION_E_NONE, ctx->parent_app_api_context))
{
TLS_DBG (1, "failed to notify app");
+ app_session->session_state = SESSION_STATE_CONNECTING;
tls_disconnect (ctx->tls_ctx_handle, vlib_get_thread_index ());
return -1;
}
ctx->app_session_handle = session_handle (app_session);
- app_session->session_state = SESSION_STATE_READY;
return 0;
@@ -745,14 +745,14 @@ tls_custom_tx_callback (void *session, transport_send_params_t * sp)
u8 *
format_tls_ctx (u8 * s, va_list * args)
{
- u32 tcp_si, tcp_ti, ctx_index, ctx_engine, app_si, app_ti;
+ u32 tcp_si, tcp_ti, ctx_index, ctx_engine;
tls_ctx_t *ctx = va_arg (*args, tls_ctx_t *);
session_parse_handle (ctx->tls_session_handle, &tcp_si, &tcp_ti);
tls_ctx_parse_handle (ctx->tls_ctx_handle, &ctx_index, &ctx_engine);
- session_parse_handle (ctx->app_session_handle, &app_si, &app_ti);
s = format (s, "[%d:%d][TLS] app_wrk %u index %u engine %u tcp %d:%d",
- app_ti, app_si, ctx->parent_app_wrk_index, ctx_index,
+ ctx->c_thread_index, ctx->c_s_index,
+ ctx->parent_app_wrk_index, ctx_index,
ctx_engine, tcp_ti, tcp_si);
return s;
@@ -763,16 +763,15 @@ format_tls_listener_ctx (u8 * s, va_list * args)
{
session_t *tls_listener;
app_listener_t *al;
- u32 app_si, app_ti;
tls_ctx_t *ctx;
ctx = va_arg (*args, tls_ctx_t *);
al = app_listener_get_w_handle (ctx->tls_session_handle);
tls_listener = app_listener_get_session (al);
- session_parse_handle (ctx->app_session_handle, &app_si, &app_ti);
s = format (s, "[%d:%d][TLS] app_wrk %u engine %u tcp %d:%d",
- app_ti, app_si, ctx->parent_app_wrk_index, ctx->tls_ctx_engine,
+ ctx->c_thread_index, ctx->c_s_index,
+ ctx->parent_app_wrk_index, ctx->tls_ctx_engine,
tls_listener->thread_index, tls_listener->session_index);
return s;
@@ -785,7 +784,7 @@ format_tls_ctx_state (u8 * s, va_list * args)
session_t *ts;
ctx = va_arg (*args, tls_ctx_t *);
- ts = session_get_from_handle (ctx->app_session_handle);
+ ts = session_get (ctx->c_s_index, ctx->c_thread_index);
if (ts->session_state == SESSION_STATE_LISTENING)
s = format (s, "%s", "LISTEN");
else