summaryrefslogtreecommitdiffstats
path: root/src/vcl/vcl_test_server.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-09-09 09:40:51 -0700
committerFlorin Coras <florin.coras@gmail.com>2018-09-10 03:15:16 +0000
commit2179513b71963a0b42ca6f1f2b641e79ce89447b (patch)
tree049f4f13ad1aa81d59be4a153b501288be497e10 /src/vcl/vcl_test_server.c
parent97f592f474ebaeba0c9a0f50db8f5627cc444aca (diff)
session: lock app worker mq for io events
Also fixes vcl client/server stats and closing procedure. Change-Id: I7d5a274ea0a3c8ea13062bf61bf402248dfe1a19 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vcl/vcl_test_server.c')
-rw-r--r--src/vcl/vcl_test_server.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/vcl/vcl_test_server.c b/src/vcl/vcl_test_server.c
index 2fdd7ec157d..5c8656c9603 100644
--- a/src/vcl/vcl_test_server.c
+++ b/src/vcl/vcl_test_server.c
@@ -497,6 +497,7 @@ vts_worker_init (vcl_test_server_worker_t * wrk)
if (rv < 0)
vtfail ("vppcom_epoll_ctl", rv);
+ ssm->active_workers += 1;
vtinf ("Waiting for a client to connect on port %d ...", ssm->cfg.port);
}
@@ -532,6 +533,12 @@ vts_worker_loop (void *arg)
if (wrk->wait_events[i].events & (EPOLLHUP | EPOLLRDHUP))
{
vppcom_session_close (conn->fd);
+ wrk->nfds -= 1;
+ if (!wrk->nfds)
+ {
+ vtinf ("All client connections closed\n");
+ goto done;
+ }
continue;
}
if (wrk->wait_events[i].data.u32 == ~0)
@@ -542,6 +549,7 @@ vts_worker_loop (void *arg)
if (EPOLLIN & wrk->wait_events[i].events)
{
+ read_again:
rx_bytes = vcl_test_read (conn->fd, conn->buf,
conn->buf_size, &conn->stats);
@@ -563,7 +571,6 @@ vts_worker_loop (void *arg)
if (!wrk->nfds)
{
vtinf ("All client connections closed\n");
- vtinf ("May the force be with you!\n");
goto done;
}
continue;
@@ -572,6 +579,9 @@ vts_worker_loop (void *arg)
|| (conn->cfg.test == SOCK_TEST_TYPE_BI))
{
vts_server_rx (conn, rx_bytes);
+ if (vppcom_session_attr (conn->fd, VPPCOM_ATTR_GET_NREAD, 0,
+ 0) > 0)
+ goto read_again;
continue;
}
else if (isascii (conn->buf[0]))