Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit b0042566 authored by Tom Marshall's avatar Tom Marshall Committed by Nolen Johnson
Browse files

DnsResolver: Sort and cache hosts file data for fast lookup

The hosts file is normally searched linearly.  This is very slow when
the file is large.  To mitigate this, read the hosts file and sort the
entries in an in-memory cache.  When an address is requested via
gethostbyname or getaddrinfo, binary search the cache.

In case where the cache is not available, return a suitable error code
and fall back to the existing lookup code.

This has been written to behave as much like the existing lookup code as
possible.  But note bionic and glibc differ in behavior for some corner
cases.  Choose the most standard compliant behavior for these where
possible.  Otherwise choose the behavior that seems most reasonable.

Note: this change is the analogue of the bionic change of the same name.
Both should be kept in sync.

Change-Id: I5926493864d4b1291ae83f8b601bf5dcc54085cd
parent 4a35e679
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment