summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2019-06-19 14:47:41 +0200
committerFlorin Coras <florin.coras@gmail.com>2019-06-20 14:43:19 +0000
commite4a1a328351482a900ba4da9d47ff8eaa0dd6ffd (patch)
treee67c59c9d557fe30de5eb06430d9ae0dc856c256
parentff55c816c966bdd6928c22ee764358c0a61436dc (diff)
quic: remove session flags identifying Q/S sessions
Type: refactor Change-Id: Id68c5ae6d57df0fc556bbf583a66e538e641ffb1 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
-rw-r--r--src/plugins/quic/quic.c11
-rw-r--r--src/vnet/session-apps/echo_client.c2
-rw-r--r--src/vnet/session-apps/echo_server.c8
-rw-r--r--src/vnet/session/session_types.h1
4 files changed, 10 insertions, 12 deletions
diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c
index 16ad2c1cdb0..0b6c975935e 100644
--- a/src/plugins/quic/quic.c
+++ b/src/plugins/quic/quic.c
@@ -541,7 +541,6 @@ quic_accept_stream (void *s)
sctx->c_s_index = stream_session->session_index;
stream_session->session_state = SESSION_STATE_CREATED;
- stream_session->flags |= SESSION_F_QUIC_STREAM;
stream_session->app_wrk_index = sctx->c_quic_ctx_id.parent_app_wrk_id;
stream_session->connection_index = sctx->c_c_index;
stream_session->session_type =
@@ -1194,7 +1193,6 @@ quic_connect_new_stream (session_endpoint_cfg_t * sep)
QUIC_DBG (2, "Allocated stream_session, id %u, thread %u ctx %u",
stream_session->session_index, stream_session->thread_index,
sctx_index);
- stream_session->flags |= SESSION_F_QUIC_STREAM;
stream_session->app_wrk_index = app_wrk->wrk_index;
stream_session->connection_index = sctx_index;
stream_session->listener_handle = quic_session_handle;
@@ -1500,14 +1498,12 @@ quic_build_sockaddr (struct sockaddr *sa, socklen_t * salen,
}
static int
-quic_notify_app_connected (quic_ctx_t * ctx)
+quic_on_client_connected (quic_ctx_t * ctx)
{
- QUIC_DBG (1, "quic_notify_app_connected");
session_t *quic_session;
app_worker_t *app_wrk;
u32 ctx_id = ctx->c_c_index;
u32 thread_index = ctx->c_thread_index;
- quic_ctx_t *lctx;
app_wrk = app_worker_get_if_valid (ctx->c_quic_ctx_id.parent_app_wrk_id);
if (!app_wrk)
@@ -1518,13 +1514,12 @@ quic_notify_app_connected (quic_ctx_t * ctx)
quic_session = session_alloc (thread_index);
- lctx = quic_ctx_get (ctx->c_quic_ctx_id.listener_ctx_id, 0);
QUIC_DBG (2, "Allocated quic_session, id %u, thread %u",
quic_session->session_index, quic_session->thread_index);
ctx->c_s_index = quic_session->session_index;
quic_session->app_wrk_index = ctx->c_quic_ctx_id.parent_app_wrk_id;
quic_session->connection_index = ctx->c_c_index;
- quic_session->listener_handle = lctx->c_s_index;
+ quic_session->listener_handle = SESSION_INVALID_HANDLE;
quic_session->session_type =
session_type_from_proto_and_ip (TRANSPORT_PROTO_QUIC,
ctx->c_quic_ctx_id.udp_is_ip4);
@@ -1911,7 +1906,7 @@ quic_receive (quic_ctx_t * ctx, quicly_conn_t * conn,
ctx->conn_state = QUIC_CONN_STATE_READY;
if (quicly_is_client (conn))
{
- quic_notify_app_connected (ctx);
+ quic_on_client_connected (ctx);
ctx = quic_ctx_get (ctx_id, thread_index);
}
}
diff --git a/src/vnet/session-apps/echo_client.c b/src/vnet/session-apps/echo_client.c
index bde9f489a34..24a3433d707 100644
--- a/src/vnet/session-apps/echo_client.c
+++ b/src/vnet/session-apps/echo_client.c
@@ -420,7 +420,7 @@ quic_echo_clients_session_connected_callback (u32 app_index, u32 api_context,
return 0;
}
- if (!(s->flags & SESSION_F_QUIC_STREAM))
+ if (s->listener_handle == SESSION_INVALID_HANDLE)
return quic_echo_clients_qsession_connected_callback (app_index,
api_context, s,
is_fail);
diff --git a/src/vnet/session-apps/echo_server.c b/src/vnet/session-apps/echo_server.c
index 7459d03202f..b7a74818cca 100644
--- a/src/vnet/session-apps/echo_server.c
+++ b/src/vnet/session-apps/echo_server.c
@@ -55,6 +55,7 @@ typedef struct
u64 byte_index;
u32 **rx_retries;
u8 transport_proto;
+ u64 listener_handle; /**< Session handle of the root listener */
vlib_main_t *vlib_main;
} echo_server_main_t;
@@ -72,7 +73,7 @@ int
quic_echo_server_session_accept_callback (session_t * s)
{
echo_server_main_t *esm = &echo_server_main;
- if (!(s->flags & SESSION_F_QUIC_STREAM))
+ if (s->listener_handle == esm->listener_handle)
return quic_echo_server_qsession_accept_callback (s);
DBG ("SSESSION %u accept w/opaque %d", s->session_index, s->opaque);
@@ -398,12 +399,15 @@ echo_server_detach (void)
static int
echo_server_listen ()
{
+ int rv;
echo_server_main_t *esm = &echo_server_main;
vnet_listen_args_t _a, *a = &_a;
clib_memset (a, 0, sizeof (*a));
a->app_index = esm->app_index;
a->uri = esm->server_uri;
- return vnet_bind_uri (a);
+ rv = vnet_bind_uri (a);
+ esm->listener_handle = a->handle;
+ return rv;
}
static int
diff --git a/src/vnet/session/session_types.h b/src/vnet/session/session_types.h
index ae5d4db2296..be1111f3b20 100644
--- a/src/vnet/session/session_types.h
+++ b/src/vnet/session/session_types.h
@@ -131,7 +131,6 @@ typedef enum session_flags_
{
SESSION_F_RX_EVT = 1,
SESSION_F_PROXY = (1 << 1),
- SESSION_F_QUIC_STREAM = (1 << 2),
} session_flags_t;
typedef struct session_