From 7c75b9836e36b0cb1dcd2220c340818e7b955a2e Mon Sep 17 00:00:00 2001 From: Anthony Hu Date: Thu, 12 Aug 2021 11:13:15 -0400 Subject: [PATCH] Changes to make Jenkins happy and reduce verbosity. - added HAVE_PTHREAD guards - usleep ---> XSLEEP_MS - only print polling message if verbose output requested. --- examples/benchmark/tls_bench.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/examples/benchmark/tls_bench.c b/examples/benchmark/tls_bench.c index 6186f78fb..9dc8b810b 100644 --- a/examples/benchmark/tls_bench.c +++ b/examples/benchmark/tls_bench.c @@ -755,9 +755,18 @@ static int SetupSocketAndConnect(info_t* info, const char* host, } /* Connect to the server */ - while (info->serverListening == 0) { - fprintf(stderr, "Waiting for server to listen...\n"); - usleep(1); +#ifdef HAVE_PTHREAD + while ((info->serverListening == 0) && (info->server.shutdown == 0)) { + if (info->showVerbose) { + fprintf(stderr, "Waiting for server to listen...\n"); + } + XSLEEP_MS(1); + } +#endif + + if (info->server.shutdown == 1) { + fprintf(stderr, "ERROR: server side has shutdown\n"); + return -1; } if (connect(info->client.sockFd, (struct sockaddr*)&servAddr, @@ -1163,7 +1172,9 @@ static int SocketWaitClient(info_t* info) info->server.sockFd = info->listenFd; } else { #endif +#ifdef HAVE_PTHREAD info->serverListening = 1; +#endif if ((connd = accept(info->listenFd, (struct sockaddr*)&clientAddr, &size)) == -1) { if (errno == SOCKET_EWOULDBLOCK) return -2;