vcl: add support for multi-worker apps
Add basic support for app registration of multiple workers. LDP does not
work with multi-worker apps.
Change-Id: I3fc421a2a591a077b275827463f874b261415a63
Signed-off-by: Florin Coras <fcoras@cisco.com>
diff --git a/src/vcl/vcl_test_client.c b/src/vcl/vcl_test_client.c
index a34648b..af51b66 100644
--- a/src/vcl/vcl_test_client.c
+++ b/src/vcl/vcl_test_client.c
@@ -112,10 +112,8 @@
sock_client_main_t *scm = &sock_client_main;
sock_test_socket_t *ctrl = &scm->ctrl_socket;
sock_test_socket_t *tsock;
- int rx_bytes, tx_bytes, nbytes;
- uint32_t i, n;
- int rv;
- int nfds = 0;
+ int rv, nfds = 0, rx_bytes, tx_bytes, nbytes;
+ uint32_t i, n, sidx;
fd_set wr_fdset, rd_fdset;
fd_set _wfdset, *wfdset = &_wfdset;
fd_set _rfdset, *rfdset = &_rfdset;
@@ -137,7 +135,9 @@
FD_SET (tsock->fd, &wr_fdset);
FD_SET (tsock->fd, &rd_fdset);
- nfds = ((tsock->fd + 1) > nfds) ? (tsock->fd + 1) : nfds;
+ sidx = vppcom_session_index (tsock->fd);
+ nfds = sidx > nfds ? sidx : nfds;
+// nfds = ((tsock->fd + 1) > nfds) ? (tsock->fd + 1) : nfds;
}
nfds++;
@@ -166,7 +166,7 @@
(tsock->stats.stop.tv_nsec == 0)))
continue;
- if (FD_ISSET (tsock->fd, wfdset)
+ if (FD_ISSET (vppcom_session_index (tsock->fd), wfdset)
&& (tsock->stats.tx_bytes < ctrl->cfg.total_bytes))
{
@@ -182,7 +182,7 @@
}
- if ((FD_ISSET (tsock->fd, rfdset)) &&
+ if ((FD_ISSET (vppcom_session_index (tsock->fd), rfdset)) &&
(tsock->stats.rx_bytes < ctrl->cfg.total_bytes))
{
rx_bytes = vcl_test_read (tsock->fd, (uint8_t *) tsock->rxbuf,