summaryrefslogtreecommitdiffstats
path: root/src/vnet/session
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/session')
-rw-r--r--src/vnet/session/application.h2
-rw-r--r--src/vnet/session/application_interface.h3
-rw-r--r--src/vnet/session/application_worker.c7
-rw-r--r--src/vnet/session/session.c7
-rw-r--r--src/vnet/session/session.h1
5 files changed, 14 insertions, 6 deletions
diff --git a/src/vnet/session/application.h b/src/vnet/session/application.h
index eca3d3cf2c5..5ddf1d21fe3 100644
--- a/src/vnet/session/application.h
+++ b/src/vnet/session/application.h
@@ -314,7 +314,7 @@ int app_worker_init_connected (app_worker_t * app_wrk, session_t * s);
int app_worker_connect_notify (app_worker_t * app_wrk, session_t * s,
session_error_t err, u32 opaque);
int app_worker_add_half_open (app_worker_t *app_wrk, session_handle_t sh);
-int app_worker_del_half_open (app_worker_t *app_wrk, u32 ho_index);
+int app_worker_del_half_open (app_worker_t *app_wrk, session_t *s);
int app_worker_close_notify (app_worker_t * app_wrk, session_t * s);
int app_worker_transport_closed_notify (app_worker_t * app_wrk,
session_t * s);
diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h
index 14db42a0009..733f5dc0ef6 100644
--- a/src/vnet/session/application_interface.h
+++ b/src/vnet/session/application_interface.h
@@ -53,6 +53,9 @@ typedef struct session_cb_vft_
/** Notify app that session or transport are about to be removed */
void (*session_cleanup_callback) (session_t * s, session_cleanup_ntf_t ntf);
+ /** Notify app that half open state was cleaned up (optional) */
+ void (*half_open_cleanup_callback) (session_t *s);
+
/** Notify app that session was reset */
void (*session_reset_callback) (session_t * s);
diff --git a/src/vnet/session/application_worker.c b/src/vnet/session/application_worker.c
index b55c55aea47..fad70c06de3 100644
--- a/src/vnet/session/application_worker.c
+++ b/src/vnet/session/application_worker.c
@@ -393,10 +393,13 @@ app_worker_add_half_open (app_worker_t *app_wrk, session_handle_t sh)
}
int
-app_worker_del_half_open (app_worker_t *app_wrk, u32 ho_index)
+app_worker_del_half_open (app_worker_t *app_wrk, session_t *s)
{
+ application_t *app = application_get (app_wrk->app_index);
ASSERT (vlib_get_thread_index () == 0);
- pool_put_index (app_wrk->half_open_table, ho_index);
+ pool_put_index (app_wrk->half_open_table, s->ho_index);
+ if (app->cb_fns.half_open_cleanup_callback)
+ app->cb_fns.half_open_cleanup_callback (s);
return 0;
}
diff --git a/src/vnet/session/session.c b/src/vnet/session/session.c
index 16b6ce412ac..0d2301c5f83 100644
--- a/src/vnet/session/session.c
+++ b/src/vnet/session/session.c
@@ -316,7 +316,7 @@ session_half_open_delete_notify (transport_connection_t *tc)
s = ho_session_get (tc->s_index);
app_wrk = app_worker_get (s->app_wrk_index);
- app_worker_del_half_open (app_wrk, s->ho_index);
+ app_worker_del_half_open (app_wrk, s);
session_free (s);
}
@@ -339,7 +339,7 @@ session_alloc_for_connection (transport_connection_t * tc)
return s;
}
-static session_t *
+session_t *
session_alloc_for_half_open (transport_connection_t *tc)
{
session_t *s;
@@ -1297,7 +1297,8 @@ session_open_vc (session_endpoint_cfg_t *rmt, session_handle_t *rsh)
ho->opaque = rmt->opaque;
*rsh = session_handle (ho);
- session_lookup_add_half_open (tc, tc->c_index);
+ if (!(tc->flags & TRANSPORT_CONNECTION_F_NO_LOOKUP))
+ session_lookup_add_half_open (tc, tc->c_index);
return 0;
}
diff --git a/src/vnet/session/session.h b/src/vnet/session/session.h
index e29cdbfc933..d14c68971de 100644
--- a/src/vnet/session/session.h
+++ b/src/vnet/session/session.h
@@ -759,6 +759,7 @@ void session_node_enable_disable (u8 is_en);
clib_error_t *vnet_session_enable_disable (vlib_main_t * vm, u8 is_en);
session_t *session_alloc_for_connection (transport_connection_t * tc);
+session_t *session_alloc_for_half_open (transport_connection_t *tc);
#endif /* __included_session_h__ */