session: fix cleanup for refused sessions

Type: fix

Change-Id: I739b7129c7e5a3fccefcdeeaf7f4a298223dd8eb
Signed-off-by: Florin Coras <fcoras@cisco.com>
diff --git a/src/vnet/session/session_input.c b/src/vnet/session/session_input.c
index 5899242..e7a81c3 100644
--- a/src/vnet/session/session_input.c
+++ b/src/vnet/session/session_input.c
@@ -155,7 +155,7 @@
 	  if (app->cb_fns.session_accept_callback (s))
 	    {
 	      session_close (s);
-	      s->app_wrk_index = SESSION_INVALID_INDEX;
+	      s->app_wrk_index = APP_INVALID_INDEX;
 	      break;
 	    }
 	  if (is_builtin)
@@ -185,7 +185,7 @@
 	  if (rv)
 	    {
 	      session_close (s);
-	      s->app_wrk_index = SESSION_INVALID_INDEX;
+	      s->app_wrk_index = APP_INVALID_INDEX;
 	      break;
 	    }
 	  if (old_state >= SESSION_STATE_TRANSPORT_CLOSING)
@@ -234,10 +234,11 @@
 	case SESSION_CTRL_EVT_CLEANUP:
 	  s = session_get (evt->as_u64[0] & 0xffffffff, thread_index);
 	  /* Notification enqueued before session was refused by app */
-	  if (PREDICT_FALSE (s->app_wrk_index == APP_INVALID_INDEX))
-	    break;
-	  if (app->cb_fns.session_cleanup_callback)
-	    app->cb_fns.session_cleanup_callback (s, evt->as_u64[0] >> 32);
+	  if (PREDICT_TRUE (s->app_wrk_index != APP_INVALID_INDEX))
+	    {
+	      if (app->cb_fns.session_cleanup_callback)
+		app->cb_fns.session_cleanup_callback (s, evt->as_u64[0] >> 32);
+	    }
 	  if (evt->as_u64[0] >> 32 != SESSION_CLEANUP_SESSION)
 	    break;
 	  uword_to_pointer (evt->as_u64[1], void (*) (session_t * s)) (s);