+ /*
+ * Clean up local session table. If we have a listener session use it to
+ * find the port and proto. If not, the handle must be a local table handle
+ * so parse it.
+ */
+
+ if (application_has_local_scope (app))
+ {
+ session_endpoint_t sep = SESSION_ENDPOINT_NULL;
+ if (!session_lookup_local_is_handle (handle))
+ listener = listen_session_get_from_handle (handle);
+ if (listener)
+ {
+ if (listen_session_get_local_session_endpoint (listener, &sep))
+ {
+ clib_warning ("broken listener");
+ return -1;
+ }
+ }
+ else
+ {
+ if (session_lookup_local_listener_parse_handle (handle, &sep))
+ {
+ clib_warning ("can't parse handle");
+ return -1;
+ }
+ }
+ table_index = application_local_session_table (app);
+ session_lookup_del_session_endpoint (table_index, &sep);
+ }
+
+ /*
+ * Clear the global scope table of the listener
+ */
+ if (application_has_global_scope (app))
+ return application_stop_listen (app, handle);
+ return 0;
+}
+
+static int
+app_connect_redirect (application_t * server, void *mp)
+{
+ return server->cb_fns.redirect_connect_callback (server->api_client_index,
+ mp);