Changes to make Jenkins happy and reduce verbosity.

- added HAVE_PTHREAD guards
- usleep ---> XSLEEP_MS
- only print polling message if verbose output requested.
This commit is contained in:
Anthony Hu
2021-08-12 11:13:15 -04:00
parent 586317f198
commit 7c75b9836e

View File

@ -755,9 +755,18 @@ static int SetupSocketAndConnect(info_t* info, const char* host,
}
/* Connect to the server */
while (info->serverListening == 0) {
#ifdef HAVE_PTHREAD
while ((info->serverListening == 0) && (info->server.shutdown == 0)) {
if (info->showVerbose) {
fprintf(stderr, "Waiting for server to listen...\n");
usleep(1);
}
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;