- /* TODO check listener depth and update */
- /* TODO on "child" fd close, update listener depth */
-
- /* Allocate local session and set it up */
- pool_get (vcm->sessions, session);
- memset (session, 0, sizeof (*session));
- session_index = (u32) (session - vcm->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->vpp_handle = mp->handle;
- session->client_context = mp->context;
- session->rx_fifo = rx_fifo;
- session->tx_fifo = tx_fifo;
- session->vpp_evt_q = uword_to_pointer (mp->vpp_event_queue_address,
- svm_msg_q_t *);
- session->session_state = STATE_ACCEPT;
- session->transport.rmt_port = mp->port;
- session->transport.is_ip4 = mp->is_ip4;
- clib_memcpy (&session->transport.rmt_ip, mp->ip, sizeof (ip46_address_t));
-
- /* Add it to lookup table */
- hash_set (vcm->session_index_by_vpp_handles, mp->handle, session_index);
- session->transport.lcl_port = listen_session->transport.lcl_port;
- session->transport.lcl_ip = listen_session->transport.lcl_ip;
-
- /* Create an event for handlers */
-
- VCL_EVENTS_LOCK ();
-
- pool_get (vcm->event_thread.vce_events, ev);
- ev_idx = (u32) (ev - vcm->event_thread.vce_events);
- ecr = vce_get_event_data (ev, sizeof (*ecr));
- ev->evk.eid = VCL_EVENT_CONNECT_REQ_ACCEPTED;
- listen_session = vppcom_session_table_lookup_listener (mp->listener_handle);
- ev->evk.session_index = (u32) (listen_session - vcm->sessions);
- ecr->accepted_session_index = session_index;
-
- VCL_EVENTS_UNLOCK ();
-
- rv = vce_generate_event (&vcm->event_thread, ev_idx);
- ASSERT (rv == 0);
-
- VDBG (1, "VCL<%d>: vpp handle 0x%llx, sid %u: client accept request from %s"
- " address %U port %d queue %p!", getpid (), mp->handle, session_index,
- mp->is_ip4 ? "IPv4" : "IPv6", format_ip46_address, &mp->ip,
- mp->is_ip4 ? IP46_TYPE_IP4 : IP46_TYPE_IP6,
- clib_net_to_host_u16 (mp->port), session->vpp_evt_q);
-
- vcl_evt (VCL_EVT_ACCEPT, session, listen_session, session_index);
- VCL_SESSION_UNLOCK ();