From 025de935255c05d72a5c35d86c6c5c4d212247a1 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Thu, 5 Feb 2026 14:13:02 +0000 Subject: Make all the DNS asynchronous --- src/qmail-smtpc/qmail-smtpc.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'src/qmail-smtpc/qmail-smtpc.c') diff --git a/src/qmail-smtpc/qmail-smtpc.c b/src/qmail-smtpc/qmail-smtpc.c index f194700..0e0b11b 100644 --- a/src/qmail-smtpc/qmail-smtpc.c +++ b/src/qmail-smtpc/qmail-smtpc.c @@ -25,7 +25,7 @@ int main (int argc, char const *const *argv) smtproutes routes = SMTPROUTES_ZERO ; unsigned int timeoutconnect = 60, timeoutremote = 1200 ; char const *host ; - size_t mepos, helopos, hostpos = 0, senderpos ; + size_t mepos, helopos, hostpos = 0 ; uint16_t port = 25 ; int r ; @@ -35,7 +35,7 @@ int main (int argc, char const *const *argv) if (sig_altignore(SIGPIPE) == -1) qmailr_tempsys("Unable to ignore SIGPIPE") ; host = *argv++ ; argc-- ; tain_now_set_stopwatch_g() ; - dns_init() ; + /* init control */ @@ -74,20 +74,11 @@ int main (int argc, char const *const *argv) smtproutes_free(&routes) ; } - // TODO: box_encode(&senderpos) ; - { - genalloc mxpos = GENALLOC_ZERO ; - int usehost ; - size_t recippos[argc] ; - - dns_canon(host, argv, argc, recippos, hostpos ? 0 : &mxpos, &storage) ; - usehost = hostpos || !genalloc_len(size_t, &mxpos) ; + genalloc mxipind = GENALLOC_ZERO ; + size_t eaddrpos[argc] ; + dns_stuff(hostpos ? storage.s + hostpos : host, argv, argc, eaddrpos, &mxipind, &storage, timeoutconnect, ipme4.s, ipme4.len >> 2, ipme6.s, ipme6.len >> 4, !hostpos) ; - unsigned int mxn = usehost ? 1 : genalloc_len(size_t, &mxpos) ; - mxip mxind[mxn] ; - dns_ip_of_mx(usehost ? &hostpos : genalloc_s(size_t, &mxpos), mxn, mxind, &storage, ipme4.s, ipme4.len >> 2, ipme6.s, ipme6.len >> 4) ; - genalloc_free(size_t, &mxpos) ; } -- cgit v1.3.1