diff options
author | Florin Coras <fcoras@cisco.com> | 2019-08-29 12:03:17 -0700 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2019-08-30 13:15:42 +0000 |
commit | 57c88938f8a80e63e7307cacaca23b0ab3a51b6c (patch) | |
tree | b62690ce6a9b9d07fee1b83e8b2cf3d8fb8bdece /src/plugins/hs_apps/vcl/sock_test_client.c | |
parent | a495a3ea146a8484dac9f6b594fb2b044437c7a4 (diff) |
vcl: allow non-blocking connects
Type: feature
Change-Id: I55349f482ce6781337f747b2f0d2c0a027c3a675
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/plugins/hs_apps/vcl/sock_test_client.c')
-rw-r--r-- | src/plugins/hs_apps/vcl/sock_test_client.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/plugins/hs_apps/vcl/sock_test_client.c b/src/plugins/hs_apps/vcl/sock_test_client.c index 13227f28265..ed43e7faaf1 100644 --- a/src/plugins/hs_apps/vcl/sock_test_client.c +++ b/src/plugins/hs_apps/vcl/sock_test_client.c @@ -651,14 +651,6 @@ sock_test_connect_test_sockets (uint32_t num_test_sockets) errno_val); return tsock->fd; } - if (fcntl (tsock->fd, F_SETFL, O_NONBLOCK) < 0) - { - errno_val = errno; - perror ("ERROR in sock_test_connect_test_sockets()"); - fprintf (stderr, "CLIENT: ERROR: fcntl failed (errno = %d)!\n", - errno_val); - return -1; - } #ifdef VCL_TEST rv = vppcom_session_connect (tsock->fd, &scm->server_endpt); @@ -668,9 +660,8 @@ sock_test_connect_test_sockets (uint32_t num_test_sockets) rv = -1; } #else - rv = - connect (tsock->fd, (struct sockaddr *) &scm->server_addr, - scm->server_addr_size); + rv = connect (tsock->fd, (struct sockaddr *) &scm->server_addr, + scm->server_addr_size); #endif if (rv < 0) { @@ -680,6 +671,14 @@ sock_test_connect_test_sockets (uint32_t num_test_sockets) "(errno = %d)!\n", errno_val); return -1; } + if (fcntl (tsock->fd, F_SETFL, O_NONBLOCK) < 0) + { + errno_val = errno; + perror ("ERROR in sock_test_connect_test_sockets()"); + fprintf (stderr, "CLIENT: ERROR: fcntl failed (errno = %d)!\n", + errno_val); + return -1; + } tsock->cfg = ctrl->cfg; vcl_test_session_buf_alloc (tsock); sock_test_cfg_sync (tsock); |