vcl: add support for multi-worker apps
[vpp.git] / src / vcl / vcl_test_client.c
index a34648b..af51b66 100644 (file)
@@ -112,10 +112,8 @@ echo_test_client ()
   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 @@ echo_test_client ()
 
       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 @@ echo_test_client ()
                (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 @@ echo_test_client ()
 
            }
 
-         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,