- session_t *s = session_get_from_handle (ho_handle);
- transport_cleanup_half_open (session_get_transport_proto (s),
- s->connection_index);
+ session_t *ho = session_get_from_handle (ho_handle);
+
+ /* App transports can migrate their half-opens */
+ if (ho->flags & SESSION_F_IS_MIGRATING)
+ {
+ /* Session still migrating, move to closed state to signal that the
+ * session should be removed. */
+ if (ho->connection_index == ~0)
+ {
+ ho->session_state = SESSION_STATE_CLOSED;
+ return;
+ }
+ /* Migrated transports are no longer half-opens */
+ transport_cleanup (session_get_transport_proto (ho),
+ ho->connection_index, ho->app_index /* overloaded */);
+ }
+ else
+ transport_cleanup_half_open (session_get_transport_proto (ho),
+ ho->connection_index);
+ session_free (ho);
+}
+
+static void
+session_half_open_free (session_t *ho)
+{
+ app_worker_t *app_wrk;
+
+ ASSERT (vlib_get_thread_index () <= 1);
+ app_wrk = app_worker_get (ho->app_wrk_index);
+ app_worker_del_half_open (app_wrk, ho);
+ session_free (ho);
+}
+
+static void
+session_half_open_free_rpc (void *args)
+{
+ session_t *ho = ho_session_get (pointer_to_uword (args));
+ session_half_open_free (ho);