mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-10 17:12:41 +02:00
getaddrinfo can hang for many seconds when the system stub resolver misbehaves; running it inline on the event loop froze every other request, IPC, and curl socket event for the duration. New PendingSystemResolution coalesces concurrent lookups for the same name, dispatches the call to a Threading::ThreadPool worker, and deferred-invokes the result back to the originating event loop. Each caller of lookup() gets its own Core::Promise so concurrent when_resolved/when_rejected handlers can't clobber each other; the pending state fans out to every joined caller on completion. Workers issue A and AAAA in parallel on separate sockets to sidestep the systemd-resolved AAAA-drop bug, and resolve the user's promise after the first side returns records (with a 50 ms RFC 8305 grace window for the other side). Adds Core::Socket::AddressFamily and an optional parameter to resolve_host so workers can request A or AAAA specifically.