summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/application_worker.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/session/application_worker.c')
-rw-r--r--src/vnet/session/application_worker.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/vnet/session/application_worker.c b/src/vnet/session/application_worker.c
index 47b156732ef..c67aa88db05 100644
--- a/src/vnet/session/application_worker.c
+++ b/src/vnet/session/application_worker.c
@@ -75,6 +75,8 @@ app_worker_free (app_worker_t * app_wrk)
}));
/* *INDENT-ON* */
+ hash_free (app_wrk->listeners_table);
+
for (i = 0; i < vec_len (handles); i++)
{
a->app_index = app->app_index;
@@ -83,6 +85,7 @@ app_worker_free (app_worker_t * app_wrk)
/* seg manager is removed when unbind completes */
(void) vnet_unlisten (a);
}
+ vec_reset_length (handles);
/*
* Connects segment manager cleanup
@@ -96,6 +99,31 @@ app_worker_free (app_worker_t * app_wrk)
segment_manager_init_free (sm);
}
+ /*
+ * Half-open cleanup
+ */
+
+ for (i = 0; i < vec_len (app_wrk->half_open_table); i++)
+ {
+ if (!app_wrk->half_open_table[i])
+ continue;
+
+ /* *INDENT-OFF* */
+ hash_foreach (handle, sm_index, app_wrk->half_open_table[i], ({
+ vec_add1 (handles, handle);
+ }));
+ /* *INDENT-ON* */
+
+ for (i = 0; i < vec_len (handles); i++)
+ session_cleanup_half_open (i, handles[i]);
+
+ hash_free (app_wrk->half_open_table[i]);
+ vec_reset_length (handles);
+ }
+
+ vec_free (app_wrk->half_open_table);
+ vec_free (handles);
+
/* If first segment manager is used by a listener */
if (app_wrk->first_segment_manager != APP_INVALID_SEGMENT_MANAGER_INDEX
&& app_wrk->first_segment_manager != app_wrk->connects_seg_manager)
@@ -335,6 +363,40 @@ app_worker_connect_notify (app_worker_t * app_wrk, session_t * s,
}
int
+app_worker_add_half_open (app_worker_t * app_wrk, transport_proto_t tp,
+ session_handle_t ho_handle,
+ session_handle_t wrk_handle)
+{
+ ASSERT (vlib_get_thread_index () == 0);
+ vec_validate (app_wrk->half_open_table, tp);
+ hash_set (app_wrk->half_open_table[tp], ho_handle, wrk_handle);
+ return 0;
+}
+
+int
+app_worker_del_half_open (app_worker_t * app_wrk, transport_proto_t tp,
+ session_handle_t ho_handle)
+{
+ ASSERT (vlib_get_thread_index () == 0);
+ hash_unset (app_wrk->half_open_table[tp], ho_handle);
+ return 0;
+}
+
+u64
+app_worker_lookup_half_open (app_worker_t * app_wrk, transport_proto_t tp,
+ session_handle_t ho_handle)
+{
+ u64 *ho_wrk_handlep;
+
+ /* No locking because all updates are done from main thread */
+ ho_wrk_handlep = hash_get (app_wrk->half_open_table[tp], ho_handle);
+ if (!ho_wrk_handlep)
+ return SESSION_INVALID_HANDLE;
+
+ return *ho_wrk_handlep;
+}
+
+int
app_worker_close_notify (app_worker_t * app_wrk, session_t * s)
{
application_t *app = application_get (app_wrk->app_index);