session: fix unlisten rpc barrier release

Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I9301fbbcd611033b4b6ad5313edbc66840f5bb3a
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index 8817b08..b8b5ce2 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -401,8 +401,6 @@
   sh = mp->handle;
   context = mp->context;
 
-  vlib_worker_thread_barrier_sync (vm);
-
   app = application_lookup (mp->client_index);
   if (!app)
     return;
@@ -411,15 +409,18 @@
   a->app_index = app->app_index;
   a->handle = sh;
   a->wrk_map_index = mp->wrk_index;
+
+  vlib_worker_thread_barrier_sync (vm);
+
   if ((rv = vnet_unlisten (a)))
     clib_warning ("unlisten returned: %d", rv);
 
+  vlib_worker_thread_barrier_release (vm);
+
   app_wrk = application_get_worker (app, a->wrk_map_index);
   if (!app_wrk)
     return;
 
-  vlib_worker_thread_barrier_release (vm);
-
   mq_send_unlisten_reply (app_wrk, sh, context, rv);
   clib_mem_free (mp);
 }