aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session/application_worker.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-04-16 04:30:22 +0000
committerDave Barach <openvpp@barachs.net>2020-04-17 14:58:23 +0000
commitd50ff7fba167035b10def282b5ec166fa7899948 (patch)
treec228e4e1abf11118730c568643134c887dac3d71 /src/vnet/session/application_worker.c
parentce815deb72fd3941b000aecec931131afc9d6c34 (diff)
session tcp: track half open in app wrk
Type: improvement Do extra checks when establishing an active connect and cleanup pending connects if application detaches. Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ibe9349db57b313ba2aa5ea3960ef5cf755f5098a
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);