tests/http/clients: use proper sleep() call on NonStop

This fix impacts ws-data.c and ws-pingpong.c. sleep() replaced with
system PROCESS_DELAY_() having the same resolution as usleep().

Fixes #15711
Closes #15712

Signed-off-by: Randall S. Becker <randall.becker@nexbridge.ca>
This commit is contained in:
Randall S. Becker 2024-12-10 20:02:00 +00:00 committed by Daniel Stenberg
parent ae4ec1d2ec
commit aed732acb1
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
2 changed files with 20 additions and 0 deletions

View file

@ -103,6 +103,9 @@ static CURLcode send_binary(CURL *curl, char *buf, size_t buflen)
return result;
}
#if defined(__TANDEM)
# include <cextdecs.h(PROCESS_DELAY_)>
#endif
static CURLcode recv_binary(CURL *curl, char *exp_data, size_t exp_len)
{
const struct curl_ws_frame *frame;
@ -118,6 +121,13 @@ static CURLcode recv_binary(CURL *curl, char *exp_data, size_t exp_len)
fprintf(stderr, "EAGAIN, sleep, try again\n");
#ifdef _WIN32
Sleep(100);
#elif defined(__TANDEM)
/* NonStop only defines usleep when building for a threading model */
# if defined(_PUT_MODEL_) || defined(_KLT_MODEL_)
usleep(100*1000);
# else
PROCESS_DELAY_(100*1000);
# endif
#else
usleep(100*1000);
#endif

View file

@ -94,6 +94,9 @@ static void websocket_close(CURL *curl)
"ws: curl_ws_send returned %u, sent %u\n", (int)result, (int)sent);
}
#if defined(__TANDEM)
# include <cextdecs.h(PROCESS_DELAY_)>
#endif
static CURLcode pingpong(CURL *curl, const char *payload)
{
CURLcode res;
@ -108,6 +111,13 @@ static CURLcode pingpong(CURL *curl, const char *payload)
if(res == CURLE_AGAIN) {
#ifdef _WIN32
Sleep(100);
#elif defined(__TANDEM)
/* NonStop only defines usleep when building for a threading model */
# if defined(_PUT_MODEL_) || defined(_KLT_MODEL_)
usleep(100*1000);
# else
PROCESS_DELAY_(100*1000);
# endif
#else
usleep(100*1000);
#endif