]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tests/http/clients: use proper sleep() call on NonStop
authorRandall S. Becker <randall.becker@nexbridge.ca>
Tue, 10 Dec 2024 20:02:00 +0000 (20:02 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 12 Dec 2024 13:30:28 +0000 (14:30 +0100)
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>
tests/http/clients/ws-data.c
tests/http/clients/ws-pingpong.c

index 6698326dfb8b6a78d9a82d2cc5aa4ff1f83044c8..4a3be67bf2ee097a76b798281bfb00a06bba8f81 100644 (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
index efb01bcd711396ace2e39caacbf2f17a3c787d73..f11d217f47c8146ffd75276da7a3f12ec9bcae3a 100644 (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