session: add api to detach session from app

Type: improvement

Change-Id: Ib824d0ca9efc7d8967e043db69017655b2dcf6b5
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 e7a81c3..73b7771 100644
--- a/src/vnet/session/session_input.c
+++ b/src/vnet/session/session_input.c
@@ -154,8 +154,7 @@
 	  old_state = s->session_state;
 	  if (app->cb_fns.session_accept_callback (s))
 	    {
-	      session_close (s);
-	      s->app_wrk_index = APP_INVALID_INDEX;
+	      session_detach_app (s);
 	      break;
 	    }
 	  if (is_builtin)
@@ -184,8 +183,7 @@
 	    break;
 	  if (rv)
 	    {
-	      session_close (s);
-	      s->app_wrk_index = APP_INVALID_INDEX;
+	      session_detach_app (s);
 	      break;
 	    }
 	  if (old_state >= SESSION_STATE_TRANSPORT_CLOSING)