+static vcl_session_t *
+vcl_session_accepted (vcl_worker_t * wrk, session_accepted_msg_t * msg)
+{
+ vcl_session_msg_t *vcl_msg;
+ vcl_session_t *session;
+
+ session = vcl_session_get_w_vpp_handle (wrk, msg->handle);
+ if (PREDICT_FALSE (session != 0))
+ VWRN ("session overlap handle %lu state %u!", msg->handle,
+ session->session_state);
+
+ session = vcl_session_table_lookup_listener (wrk, msg->listener_handle);
+ if (!session)
+ {
+ VERR ("couldn't find listen session: listener handle %llx",
+ msg->listener_handle);
+ return 0;
+ }
+
+ clib_fifo_add2 (session->accept_evts_fifo, vcl_msg);
+ vcl_msg->accepted_msg = *msg;
+ /* Session handle points to listener until fully accepted by app */
+ vcl_session_table_add_vpp_handle (wrk, msg->handle, session->session_index);
+
+ return session;
+}
+
+static vcl_session_t *
+vcl_session_disconnected_handler (vcl_worker_t * wrk,
+ session_disconnected_msg_t * msg)
+{
+ vcl_session_t *session;
+
+ session = vcl_session_get_w_vpp_handle (wrk, msg->handle);
+ if (!session)
+ {
+ VDBG (0, "request to disconnect unknown handle 0x%llx", msg->handle);
+ return 0;
+ }
+
+ /* Caught a disconnect before actually accepting the session */
+ if (session->session_state == STATE_LISTEN)
+ {
+
+ if (!vcl_flag_accepted_session (session, msg->handle,
+ VCL_ACCEPTED_F_CLOSED))
+ VDBG (0, "session was not accepted!");
+ return 0;
+ }
+
+ session->session_state = STATE_VPP_CLOSING;
+ return session;
+}
+