clib_error_t *error;
int rv;
- if ((error = vl_socket_client_recv_fd_msg (&ssvm->fd, 5)))
+ if ((error = vl_socket_client_recv_fd_msg (&ssvm->fd, 1, 5)))
{
clib_error_report (error);
return -1;
if (type == SSVM_SEGMENT_MEMFD)
{
- if ((error = vl_socket_client_recv_fd_msg (&a->memfd_fd, 5)))
+ if ((error = vl_socket_client_recv_fd_msg (&a->memfd_fd, 1, 5)))
{
clib_error_report (error);
return -1;
u64 test_buf_len, bytes_this_chunk, test_buf_offset;
svm_fifo_t *tx_fifo = s->server_tx_fifo;
u8 *test_data = em->connect_test_data;
- u32 enq_space, min_chunk = 16 << 10;
+ u32 enq_space = 16 << 10;
int written;
test_buf_len = vec_len (test_data);
bytes_this_chunk = clib_min (test_buf_len - test_buf_offset,
s->bytes_to_send);
enq_space = svm_fifo_max_enqueue (tx_fifo);
- if (enq_space < clib_min (bytes_this_chunk, min_chunk))
- return;
bytes_this_chunk = clib_min (bytes_this_chunk, enq_space);
written = svm_fifo_enqueue_nowait (tx_fifo, bytes_this_chunk,
int rv = 0;
p = hash_get (em->session_index_by_vpp_handles, mp->handle);
-
- if (p)
- {
- clib_warning ("disconnected");
- session = pool_elt_at_index (em->sessions, p[0]);
- hash_unset (em->session_index_by_vpp_handles, mp->handle);
- pool_put (em->sessions, session);
- }
- else
+ if (!p)
{
clib_warning ("couldn't find session key %llx", mp->handle);
- rv = -11;
+ return;
}
+ session = pool_elt_at_index (em->sessions, p[0]);
+ hash_unset (em->session_index_by_vpp_handles, mp->handle);
+ pool_put (em->sessions, session);
+
app_alloc_ctrl_evt_to_vpp (session->vpp_evt_q, app_evt,
SESSION_CTRL_EVT_DISCONNECTED_REPLY);
rmp = (session_disconnected_reply_msg_t *) app_evt->evt->data;
rmp->context = mp->context;
app_send_ctrl_evt_to_vpp (session->vpp_evt_q, app_evt);
- if (session)
- session_print_stats (em, session);
+ session_print_stats (em, session);
}
static void
echo_main_t *em = &echo_main;
unformat_input_t _argv, *a = &_argv;
u8 *chroot_prefix;
- u8 *heap, *uri = 0;
+ u8 *uri = 0;
u8 *bind_uri = (u8 *) "tcp://0.0.0.0/1234";
u8 *connect_uri = (u8 *) "tcp://6.0.1.1/1234";
u64 bytes_to_send = 64 << 10, mbytes;
char *app_name;
u32 tmp;
- mheap_t *h;
-
- clib_mem_init (0, 256 << 20);
-
- heap = clib_mem_get_per_cpu_heap ();
- h = mheap_header (heap);
- /* make the main heap thread-safe */
- h->flags |= MHEAP_FLAG_THREAD_SAFE;
+ clib_mem_init_thread_safe (0, 256 << 20);
memset (em, 0, sizeof (*em));
em->session_index_by_vpp_handles = hash_create (0, sizeof (uword));