- /* Allocate local session and set it up */
- pool_get (utm->sessions, session);
- session_index = session - utm->sessions;
-
- rx_fifo = uword_to_pointer (mp->server_rx_fifo, svm_fifo_t *);
- rx_fifo->client_session_index = session_index;
- tx_fifo = uword_to_pointer (mp->server_tx_fifo, svm_fifo_t *);
- tx_fifo->client_session_index = session_index;
-
- session->server_rx_fifo = rx_fifo;
- session->server_tx_fifo = tx_fifo;
-
- /* Add it to lookup table */
- hash_set (utm->session_index_by_vpp_handles, mp->handle, session_index);
-
- utm->state = STATE_READY;
-
- /* Stats printing */
- if (pool_elts (utm->sessions) && (pool_elts (utm->sessions) % 20000) == 0)
- {
- f64 now = clib_time_now (&utm->clib_time);
- fformat (stdout, "%d active sessions in %.2f seconds, %.2f/sec...\n",
- pool_elts (utm->sessions), now - start_time,
- (f64) pool_elts (utm->sessions) / (now - start_time));
- }
-
- /*
- * Send accept reply to vpp
- */
- rmp = vl_msg_api_alloc (sizeof (*rmp));
- memset (rmp, 0, sizeof (*rmp));
- rmp->_vl_msg_id = ntohs (VL_API_ACCEPT_SESSION_REPLY);
- rmp->handle = mp->handle;
- rmp->context = mp->context;
- vl_msg_api_send_shmem (utm->vl_input_queue, (u8 *) & rmp);
-
- session->bytes_received = 0;
- session->start = clib_time_now (&utm->clib_time);
-}