session = pool_elt_at_index (utm->sessions, p[0]);
hash_unset (utm->session_index_by_vpp_handles, key);
pool_put (utm->sessions, session);
+ utm->time_to_stop = 1;
}
else
{
rmp = vl_msg_api_alloc (sizeof (*rmp));
memset (rmp, 0, sizeof (*rmp));
- rmp->_vl_msg_id = ntohs (VL_API_DISCONNECT_SESSION_REPLY);
+ rmp->_vl_msg_id = ntohs (VL_API_RESET_SESSION_REPLY);
rmp->retval = rv;
rmp->session_index = mp->session_index;
rmp->session_thread_index = mp->session_thread_index;
{
rv = svm_fifo_enqueue_nowait (tx_fifo, 0, n_read, utm->rx_buf);
}
- while (rv == -2);
+ while (rv == -2 && !utm->time_to_stop);
/* Fabricate TX event, send to vpp */
evt.fifo = tx_fifo;
if (n_read > 0)
bytes -= n_read;
}
- while (n_read < 0 || bytes > 0);
+ while ((n_read < 0 || bytes > 0) && !utm->time_to_stop);
}
void
fformat (stdout, "Test complete...\n");
}
-#define foreach_uri_msg \
-_(BIND_URI_REPLY, bind_uri_reply) \
-_(UNBIND_URI_REPLY, unbind_uri_reply) \
-_(ACCEPT_SESSION, accept_session) \
-_(CONNECT_URI_REPLY, connect_uri_reply) \
-_(DISCONNECT_SESSION, disconnect_session) \
-_(RESET_SESSION, reset_session) \
+static void
+vl_api_disconnect_session_reply_t_handler (vl_api_disconnect_session_reply_t *
+ mp)
+{
+ clib_warning ("retval %d", ntohl (mp->retval));
+}
+
+#define foreach_uri_msg \
+_(BIND_URI_REPLY, bind_uri_reply) \
+_(UNBIND_URI_REPLY, unbind_uri_reply) \
+_(ACCEPT_SESSION, accept_session) \
+_(CONNECT_URI_REPLY, connect_uri_reply) \
+_(DISCONNECT_SESSION, disconnect_session) \
+_(DISCONNECT_SESSION_REPLY, disconnect_session_reply) \
+_(RESET_SESSION, reset_session) \
_(MAP_ANOTHER_SEGMENT, map_another_segment)
void
uri_tcp_test_main_t *utm = &uri_tcp_test_main;
unformat_input_t _argv, *a = &_argv;
u8 *chroot_prefix;
- u8 *heap;
- u8 *bind_name = (u8 *) "tcp://0.0.0.0/1234";
+ u8 *heap, *uri = 0;
+ u8 *bind_uri = (u8 *) "tcp://0.0.0.0/1234";
+ u8 *connect_uri = (u8 *) "tcp://6.0.1.2/1234";
u32 tmp;
mheap_t *h;
session_t *session;
{
vl_set_memory_root_path ((char *) chroot_prefix);
}
- else if (unformat (a, "uri %s", &bind_name))
+ else if (unformat (a, "uri %s", &uri))
;
else if (unformat (a, "segment-size %dM", &tmp))
utm->configured_segment_size = tmp << 20;
}
}
- utm->uri = format (0, "%s%c", bind_name, 0);
+ if (uri)
+ {
+ utm->uri = format (0, "%s%c", uri, 0);
+ utm->connect_uri = format (0, "%s%c", uri, 0);
+ }
+ else
+ {
+ utm->uri = format (0, "%s%c", bind_uri, 0);
+ utm->connect_uri = format (0, "%s%c", connect_uri, 0);
+ }
+
utm->i_am_master = i_am_master;
utm->segment_main = &svm_fifo_segment_main;
utm->drop_packets = drop_packets;
utm->test_return_packets = test_return_packets;
- utm->connect_uri = format (0, "tcp://6.0.1.2/1234%c", 0);
setup_signal_handlers ();
uri_api_hookup (utm);
if (i_am_master == 0)
{
client_test (utm);
+ vl_client_disconnect_from_vlib ();
exit (0);
}