summaryrefslogtreecommitdiffstats
path: root/src/vnet/session
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-02-20 19:48:31 -0800
committerDamjan Marion <dmarion@me.com>2019-02-21 12:27:11 +0000
commitdfae9f938f81480995a7ef20a63d016e57dd2899 (patch)
treeb54851bda6d1931b96c0d30f822bf5876b75bca9 /src/vnet/session
parent565115edf0d6689a3f362c69240c160b49807156 (diff)
vcl/session: send unlisten over message queue
Change-Id: I68cd6c0e6be3e8088792df3885ae190bb00462b0 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session')
-rw-r--r--src/vnet/session/application_interface.h9
-rwxr-xr-xsrc/vnet/session/session_api.c31
-rw-r--r--src/vnet/session/session_types.h1
3 files changed, 39 insertions, 2 deletions
diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h
index 18878cdf568..441b5f613a7 100644
--- a/src/vnet/session/application_interface.h
+++ b/src/vnet/session/application_interface.h
@@ -95,7 +95,7 @@ typedef struct _vnet_bind_args_t
u64 handle;
} vnet_listen_args_t;
-typedef struct _vnet_unbind_args_t
+typedef struct _vnet_unlisten_args_t
{
union
{
@@ -268,6 +268,13 @@ typedef struct session_bound_msg_
u8 segment_name[128];
} __clib_packed session_bound_msg_t;
+typedef struct session_unlisten_reply_msg_
+{
+ u32 context;
+ u64 handle;
+ i32 retval;
+} __clib_packed session_unlisten_reply_msg_t;
+
typedef struct session_accepted_msg_
{
u32 context;
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index 0285691182e..f28c12c7c29 100755
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -1248,7 +1248,8 @@ vl_api_unbind_sock_t_handler (vl_api_unbind_sock_t * mp)
{
vl_api_unbind_sock_reply_t *rmp;
vnet_unlisten_args_t _a, *a = &_a;
- application_t *app;
+ app_worker_t *app_wrk;
+ application_t *app = 0;
int rv = 0;
if (session_manager_is_enabled () == 0)
@@ -1269,6 +1270,34 @@ vl_api_unbind_sock_t_handler (vl_api_unbind_sock_t * mp)
done:
REPLY_MACRO (VL_API_UNBIND_SOCK_REPLY);
+
+ /*
+ * Send reply over msg queue
+ */
+ svm_msg_q_msg_t _msg, *msg = &_msg;
+ session_unlisten_reply_msg_t *ump;
+ svm_msg_q_t *app_mq;
+ session_event_t *evt;
+
+ if (!app)
+ return;
+
+ app_wrk = application_get_worker (app, a->wrk_map_index);
+ if (!app_wrk)
+ return;
+
+ app_mq = app_wrk->event_queue;
+ if (mq_try_lock_and_alloc_msg (app_mq, msg))
+ return;
+
+ evt = svm_msg_q_msg_data (app_mq, msg);
+ clib_memset (evt, 0, sizeof (*evt));
+ evt->event_type = SESSION_CTRL_EVT_UNLISTEN_REPLY;
+ ump = (session_unlisten_reply_msg_t *) evt->data;
+ ump->context = mp->context;
+ ump->handle = mp->handle;
+ ump->retval = rv;
+ svm_msg_q_add_and_unlock (app_mq, msg);
}
static void
diff --git a/src/vnet/session/session_types.h b/src/vnet/session/session_types.h
index efa3dea950c..97c915bbae2 100644
--- a/src/vnet/session/session_types.h
+++ b/src/vnet/session/session_types.h
@@ -392,6 +392,7 @@ typedef enum
FIFO_EVENT_BUILTIN_TX,
FIFO_EVENT_RPC,
SESSION_CTRL_EVT_BOUND,
+ SESSION_CTRL_EVT_UNLISTEN_REPLY,
SESSION_CTRL_EVT_ACCEPTED,
SESSION_CTRL_EVT_ACCEPTED_REPLY,
SESSION_CTRL_EVT_CONNECTED,