VCL registration handler added to session for polling sessions

Change-Id: I5f0f3b07a7aa3f243c3d44a9a15cf0670dbb2d46
Signed-off-by: Keith Burns (alagalah) <alagalah@gmail.com>
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index bb24869..de54035 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -161,6 +161,7 @@
   u64 client_queue_address;
   u64 options[16];
   elog_track_t elog_track;
+  vce_event_handler_reg_t *poll_reg;
 } session_t;
 
 typedef struct vppcom_cfg_t_
@@ -3649,6 +3650,7 @@
   vep_session->vep.prev_sid = ~0;
   vep_session->wait_cont_idx = ~0;
   vep_session->vpp_handle = ~0;
+  vep_session->poll_reg = 0;
 
   if (VPPCOM_DEBUG > 0)
     {
@@ -3694,7 +3696,6 @@
 {
   session_t *vep_session;
   session_t *session;
-  vce_event_handler_reg_t *reg = 0;
   vce_event_t *ev = 0;
   int rv;
 
@@ -3779,8 +3780,9 @@
 	  vce_event_key_t evk;
 	  evk.session_index = session_index;
 	  evk.eid = VCL_EVENT_CONNECT_REQ_ACCEPTED;
-	  reg = vce_register_handler (&vcm->event_thread, &evk,
-				      vce_epoll_wait_connect_request_handler_fn);
+	  vep_session->poll_reg =
+	    vce_register_handler (&vcm->event_thread, &evk,
+				  vce_epoll_wait_connect_request_handler_fn);
 	}
       if (VPPCOM_DEBUG > 1)
 	clib_warning ("VCL<%d>: EPOLL_CTL_ADD: vep_idx %u, "
@@ -3861,10 +3863,11 @@
 	}
 
       /* VCL Event Un-register handler */
-      if ((session->state & STATE_LISTEN) && reg)
+      if ((session->state & STATE_LISTEN) && vep_session->poll_reg)
 	{
-	  ev = vce_get_event_from_index (&vcm->event_thread, reg->ev_idx);
-	  vce_unregister_handler (&vcm->event_thread, ev);
+	  ev = vce_get_event_from_index (&vcm->event_thread,
+					 vep_session->poll_reg->ev_idx);
+	  (void) vce_unregister_handler (&vcm->event_thread, ev);
 	}
 
       vep_session->wait_cont_idx =