Reduce DNS lookup timeout from 28s to 8s
authorRemco Rijnders <remmy@serenity-irc.net>
Sat, 7 Mar 2026 17:17:36 +0000 (12:17 -0500)
committerRemco Rijnders <remmy@serenity-irc.net>
Sat, 7 Mar 2026 17:17:36 +0000 (12:17 -0500)
The resolver used 3 retries starting at 4s with exponential backoff
(4+8+16 = 28 seconds), which made connecting painfully slow when
reverse DNS fails (common for residential IPv6). Reduce to 1 retry:
first attempt at 3s, retry at 5s (8 seconds total).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
src/res.c

index 9ec50dba133f45452335fd719dbeecf7a87ed5c3..abc64f6912507e7f9bc3bfcfe1108dba437f402d 100644 (file)
--- a/src/res.c
+++ b/src/res.c
@@ -183,14 +183,14 @@ static ResRQ *make_request (Link *lp)
     memset ((char *) nreq, 0, sizeof (ResRQ));
     nreq->next = NULL;           /* where NULL is non-zero ;) */
     nreq->sentat = time (NULL);
-    nreq->retries = 3;
+    nreq->retries = 1;
     nreq->resend = 1;
     nreq->srch = -1;
     if (lp)
        memcpy ((char *) &nreq->cinfo, (char *) lp, sizeof (Link));
     else
        memset ((char *) &nreq->cinfo, 0, sizeof (Link));
-    nreq->timeout = 4;           /* start at 4 and exponential inc. */
+    nreq->timeout = 3;           /* start at 3s, then 5s retry */
     nreq->he.h_addrtype = AF_INET;
     nreq->he.h_name = NULL;
     nreq->he.h_aliases[0] = NULL;
@@ -242,7 +242,7 @@ time_t timeout_query_list (time_t now)
            }
            else {
                rptr->sentat = now;
-               rptr->timeout += rptr->timeout;
+               rptr->timeout = 5;
                resend_query (rptr);
                tout = now + rptr->timeout;
 #ifdef DEBUG