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.c57
1 files changed, 14 insertions, 43 deletions
diff --git a/src/vnet/session/application_worker.c b/src/vnet/session/application_worker.c
index 7e03171b115..13a3edec486 100644
--- a/src/vnet/session/application_worker.c
+++ b/src/vnet/session/application_worker.c
@@ -58,9 +58,10 @@ app_worker_free (app_worker_t * app_wrk)
vnet_unlisten_args_t _a, *a = &_a;
u64 handle, *handles = 0, *sm_indices = 0;
segment_manager_t *sm;
+ session_handle_t *sh;
session_t *ls;
u32 sm_index;
- int i, j;
+ int i;
/*
* Listener cleanup
@@ -110,26 +111,10 @@ app_worker_free (app_worker_t * app_wrk)
* 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* */
+ pool_foreach (sh, app_wrk->half_open_table)
+ session_cleanup_half_open (*sh);
- for (j = 0; j < vec_len (handles); j++)
- session_cleanup_half_open (i, handles[j]);
-
- hash_free (app_wrk->half_open_table[i]);
- vec_reset_length (handles);
- }
-
- vec_free (app_wrk->half_open_table);
- vec_free (handles);
+ pool_free (app_wrk->half_open_table);
/*
* Detached listener segment managers cleanup
@@ -396,39 +381,25 @@ 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)
+app_worker_add_half_open (app_worker_t *app_wrk, session_handle_t sh)
{
+ session_handle_t *shp;
+
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;
+ pool_get (app_wrk->half_open_table, shp);
+ *shp = sh;
+
+ return (shp - app_wrk->half_open_table);
}
int
-app_worker_del_half_open (app_worker_t * app_wrk, transport_proto_t tp,
- session_handle_t ho_handle)
+app_worker_del_half_open (app_worker_t *app_wrk, u32 ho_index)
{
ASSERT (vlib_get_thread_index () == 0);
- hash_unset (app_wrk->half_open_table[tp], ho_handle);
+ pool_put_index (app_wrk->half_open_table, ho_index);
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)
{