]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
ip-happy: prevent event-based stall on retry
authorStefan Eissing <stefan@eissing.org>
Thu, 2 Oct 2025 14:39:37 +0000 (16:39 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 2 Oct 2025 20:53:58 +0000 (22:53 +0200)
When delaying an IP happy eyeball restart, set an actual timer or the
connection will stall when running event based.

Closes #18815

lib/cf-ip-happy.c

index 47560889d446509f4a2170c4ae191028ca72c306..c0150dd087473e4428bc8084285366f61a3387ef 100644 (file)
@@ -461,10 +461,10 @@ evaluate:
     else if(inconclusive) {
       /* tried all addresses, no success but some where inconclusive.
        * Let's restart the inconclusive ones. */
-      if(curlx_timediff(now, bs->last_attempt_started) >=
-         bs->attempt_delay_ms) {
-        CURL_TRC_CF(data, cf, "tried all addresses with inconclusive results"
-                    ", restarting one");
+      timediff_t since_ms = curlx_timediff(now, bs->last_attempt_started);
+      timediff_t delay_ms = bs->attempt_delay_ms - since_ms;
+      if(delay_ms <= 0) {
+        CURL_TRC_CF(data, cf, "all attempts inconclusive, restarting one");
         i = -1;
         for(a = bs->running; a; a = a->next) {
           ++i;
@@ -479,6 +479,12 @@ evaluate:
         }
         DEBUGASSERT(0); /* should not come here */
       }
+      else {
+        /* let's wait some more before restarting */
+        infof(data, "connect attempts inconclusive, retrying "
+                    "in %" FMT_TIMEDIFF_T "ms", delay_ms);
+        Curl_expire(data, delay_ms, EXPIRE_HAPPY_EYEBALLS);
+      }
       /* attempt timeout for restart has not expired yet */
       goto out;
     }