From e759bb543c38a682dc31492a3a0a58669a811538 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Wed, 8 Apr 2020 01:55:39 +0000 Subject: udp: cleanup input node Type: refactor Signed-off-by: Florin Coras Change-Id: Ida9daefc20a161b36d6f36c56267123c7f2efc01 --- src/vnet/session/session.c | 30 ++++++++++++++++++++++++++++++ src/vnet/session/session.h | 2 ++ 2 files changed, 32 insertions(+) (limited to 'src/vnet/session') diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c index 37c5d915008..9d531240f27 100644 --- a/src/vnet/session/session.c +++ b/src/vnet/session/session.c @@ -1084,6 +1084,36 @@ session_stream_accept (transport_connection_t * tc, u32 listener_index, return 0; } +int +session_dgram_accept (transport_connection_t * tc, u32 listener_index, + u32 thread_index) +{ + app_worker_t *app_wrk; + session_t *s; + int rv; + + s = session_alloc_for_connection (tc); + s->listener_handle = ((u64) thread_index << 32) | (u64) listener_index; + + if ((rv = app_worker_init_accepted (s))) + { + session_free (s); + return rv; + } + + app_wrk = app_worker_get (s->app_wrk_index); + if ((rv = app_worker_accept_notify (app_wrk, s))) + { + session_free_w_fifos (s); + return rv; + } + + s->session_state = SESSION_STATE_READY; + session_lookup_add_connection (tc, session_handle (s)); + + return 0; +} + int session_open_cl (u32 app_wrk_index, session_endpoint_t * rmt, u32 opaque) { diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h index 5e6e4060e55..956bff068b4 100644 --- a/src/vnet/session/session.h +++ b/src/vnet/session/session.h @@ -466,6 +466,8 @@ void session_transport_closed_notify (transport_connection_t * tc); void session_transport_reset_notify (transport_connection_t * tc); int session_stream_accept (transport_connection_t * tc, u32 listener_index, u32 thread_index, u8 notify); +int session_dgram_accept (transport_connection_t * tc, u32 listener_index, + u32 thread_index); /** * Initialize session layer for given transport proto and ip version * -- cgit 1.2.3-korg