- uword *p;
-
- p = hash_get (vcm->session_index_by_vpp_handles, mp->handle);
- if (p)
- {
- int rv;
- vcl_session_t *session = 0;
- u32 session_index = p[0];
-
- VCL_SESSION_LOCK_AND_GET (session_index, &session);
- session->session_state = STATE_CLOSE_ON_EMPTY;
-
- VDBG (1, "VCL<%d>: vpp handle 0x%llx, sid %u: setting state to 0x%x "
- "(%s)", getpid (), mp->handle, session_index,
- session->session_state,
- vppcom_session_state_str (session->session_state));
- VCL_SESSION_UNLOCK ();
- return;
-
- done:
- VDBG (1, "VCL<%d>: vpp handle 0x%llx, sid %u: session lookup failed!",
- getpid (), mp->handle, session_index);
- }
- else
- clib_warning ("VCL<%d>: vpp handle 0x%llx: session lookup by "
- "handle failed!", getpid (), mp->handle);
-}
-
-static void
-vl_api_reset_session_t_handler (vl_api_reset_session_t * mp)
-{
- vcl_session_t *session = 0;
- vl_api_reset_session_reply_t *rmp;
- uword *p;
- int rv = 0;
-
- p = hash_get (vcm->session_index_by_vpp_handles, mp->handle);
- if (p)
- {
- int rval;
- VCL_SESSION_LOCK ();
- rval = vppcom_session_at_index (p[0], &session);
- if (PREDICT_FALSE (rval))
- {
- rv = VNET_API_ERROR_INVALID_VALUE_2;
- clib_warning ("VCL<%d>: ERROR: vpp handle 0x%llx, sid %u: "
- "session lookup failed! returning %d %U",
- getpid (), mp->handle, p[0],
- rv, format_api_error, rv);
- }
- else
- {
- /* TBD: should this disconnect immediately and
- * flush the fifos?
- */
- session->session_state = STATE_CLOSE_ON_EMPTY;
-
- VDBG (1, "VCL<%d>: vpp handle 0x%llx, sid %u: state set to %d "
- "(%s)!", getpid (), mp->handle, p[0], session->session_state,
- vppcom_session_state_str (session->session_state));
- }
- VCL_SESSION_UNLOCK ();
- }
- else
- {
- rv = VNET_API_ERROR_INVALID_VALUE;
- clib_warning ("VCL<%d>: ERROR: vpp handle 0x%llx: session lookup "
- "failed! returning %d %U",
- getpid (), mp->handle, rv, format_api_error, rv);
- }
-
- rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
- rmp->_vl_msg_id = ntohs (VL_API_RESET_SESSION_REPLY);
- rmp->retval = htonl (rv);
- rmp->handle = mp->handle;
- vl_msg_api_send_shmem (vcm->vl_input_queue, (u8 *) & rmp);
-}