From 49ae3fd3edb957a8a2f7c7541c66b9336f25176e Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Mon, 29 Jul 2024 20:18:14 +0200 Subject: Use portable dUsleep() instead of usleep() Reviewed-by: dogma --- src/IO/dpi.c | 5 +++-- test/unit/cookies.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/IO/dpi.c b/src/IO/dpi.c index c1786de6..46ddc49e 100644 --- a/src/IO/dpi.c +++ b/src/IO/dpi.c @@ -39,6 +39,7 @@ #include "IO.h" #include "Url.h" #include "../../dpip/dpip.h" +#include "dlib/dlib.h" /* This one is tricky, some sources state it should include the byte * for the terminating NULL, and others say it shouldn't. */ @@ -504,12 +505,12 @@ static int Dpi_check_dpid(int num_tries) static int Dpi_blocking_start_dpid(void) { int cst, try = 0, - n_tries = 3; /* 3 seconds */ + n_tries = 12; /* 3 seconds */ /* test the dpid, and wait a bit for it to start if necessary */ while ((cst = Dpi_check_dpid(n_tries)) == 1) { MSG("Dpi_blocking_start_dpid: try %d\n", ++try); - sleep(1); + dUsleep(250000UL); } return cst; } diff --git a/test/unit/cookies.c b/test/unit/cookies.c index ce122ffc..caef5d7b 100644 --- a/test/unit/cookies.c +++ b/test/unit/cookies.c @@ -277,12 +277,12 @@ static int Dpi_check_dpid(int num_tries) static int Dpi_blocking_start_dpid(void) { int cst, try = 0, - n_tries = 3; /* 3 seconds */ + n_tries = 12; /* 3 seconds */ /* test the dpid, and wait a bit for it to start if necessary */ while ((cst = Dpi_check_dpid(n_tries)) == 1) { MSG("Dpi_blocking_start_dpid: try %d\n", ++try); - sleep(1); /* 1/4 sec */ + dUsleep(250000U); /* 1/4 sec */ } return cst; } -- cgit v1.2.3