Horizontal (nSessions) scaling draft
[vpp.git] / src / vnet / session / application_interface.c
index 96d2c62..566a52d 100644 (file)
@@ -113,7 +113,7 @@ vnet_unbind_i (u32 app_index, u64 handle)
 
   if (!app)
     {
-      clib_warning ("app not attached");
+      clib_warning ("app (%d) not attached", app_index);
       return VNET_API_ERROR_APPLICATION_NOT_ATTACHED;
     }
 
@@ -142,7 +142,7 @@ vnet_connect_i (u32 app_index, u32 api_context, session_type_t sst,
        * Server is willing to have a direct fifo connection created
        * instead of going through the state machine, etc.
        */
-      if (server->flags & SESSION_OPTIONS_FLAGS_USE_FIFO)
+      if (server->flags & APP_OPTIONS_FLAGS_USE_FIFO)
        return server->cb_fns.
          redirect_connect_callback (server->api_client_index, mp);
     }
@@ -247,7 +247,7 @@ vnet_application_attach (vnet_app_attach_args_t * a)
                              a->session_cb_vft)))
     return rv;
 
-  a->app_event_queue_address = (u64) app->event_queue;
+  a->app_event_queue_address = pointer_to_uword (app->event_queue);
   sm = segment_manager_get (app->first_segment_manager);
   segment_manager_get_segment_info (sm->segment_indices[0],
                                    &seg_name, &a->segment_size);
@@ -275,27 +275,6 @@ vnet_application_detach (vnet_app_detach_args_t * a)
   return 0;
 }
 
-session_type_t
-session_type_from_proto_and_ip (session_api_proto_t proto, u8 is_ip4)
-{
-  if (proto == SESSION_PROTO_TCP)
-    {
-      if (is_ip4)
-       return SESSION_TYPE_IP4_TCP;
-      else
-       return SESSION_TYPE_IP6_TCP;
-    }
-  else
-    {
-      if (is_ip4)
-       return SESSION_TYPE_IP4_UDP;
-      else
-       return SESSION_TYPE_IP6_UDP;
-    }
-
-  return SESSION_N_TYPES;
-}
-
 int
 vnet_bind_uri (vnet_bind_args_t * a)
 {
@@ -363,7 +342,11 @@ vnet_disconnect_session (vnet_disconnect_args_t * a)
   if (!s || s->app_index != a->app_index)
     return VNET_API_ERROR_INVALID_VALUE;
 
-  stream_session_disconnect (s);
+  /* We're peeking into another's thread pool. Make sure */
+  ASSERT (s->session_index == index);
+
+  session_send_session_evt_to_thread (a->handle, FIFO_EVENT_DISCONNECT,
+                                     thread_index);
   return 0;
 }
 
@@ -395,24 +378,6 @@ vnet_connect (vnet_connect_args_t * a)
   return vnet_connect_i (a->app_index, a->api_context, sst, &a->tep, a->mp);
 }
 
-int
-vnet_disconnect (vnet_disconnect_args_t * a)
-{
-  stream_session_t *session;
-  u32 session_index, thread_index;
-
-  if (api_parse_session_handle (a->handle, &session_index, &thread_index))
-    {
-      clib_warning ("Invalid handle");
-      return -1;
-    }
-
-  session = stream_session_get (session_index, thread_index);
-  stream_session_disconnect (session);
-
-  return 0;
-}
-
 /*
  * fd.io coding-style-patch-verification: ON
  *