session: use vpp to switch io events for ct sessions
[vpp.git] / src / vnet / session / session.c
index 5756792..6e24d56 100644 (file)
@@ -124,13 +124,6 @@ session_program_transport_close (session_t * s)
   session_worker_t *wrk;
   session_event_t *evt;
 
-  if (!session_has_transport (s))
-    {
-      /* Polling may not be enabled on main thread so close now */
-      session_transport_close (s);
-      return;
-    }
-
   /* If we are in the handler thread, or being called with the worker barrier
    * held, just append a new event to pending disconnects vector. */
   if (vlib_thread_is_main_w_barrier () || thread_index == s->thread_index)
@@ -483,7 +476,7 @@ session_notify_subscribers (u32 app_index, session_t * s,
  * @return 0 on success or negative number if failed to send notification.
  */
 static inline int
-session_enqueue_notify (session_t * s)
+session_enqueue_notify_inline (session_t * s)
 {
   app_worker_t *app_wrk;
 
@@ -512,6 +505,12 @@ session_enqueue_notify (session_t * s)
   return 0;
 }
 
+int
+session_enqueue_notify (session_t * s)
+{
+  return session_enqueue_notify_inline (s);
+}
+
 int
 session_dequeue_notify (session_t * s)
 {
@@ -560,7 +559,11 @@ session_main_flush_enqueue_events (u8 transport_proto, u32 thread_index)
          errors++;
          continue;
        }
-      if (PREDICT_FALSE (session_enqueue_notify (s)))
+
+      if (svm_fifo_is_empty (s->rx_fifo))
+       continue;
+
+      if (PREDICT_FALSE (session_enqueue_notify_inline (s)))
        errors++;
     }