diff options
author | Tom Marshall <tdm@cyngn.com> | 2016-06-17 16:38:12 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2016-08-04 08:15:45 -0700 |
commit | 545862d54af2b210bba725cc655857f7d7068ad9 (patch) | |
tree | 83c7fca84541c27b6f532bff1cb179bc9e140dfe /libstdc++ | |
parent | 4e646507b980f2a1cd5dd8dee3e9e70e8880ce54 (diff) | |
download | bionic-545862d54af2b210bba725cc655857f7d7068ad9.zip bionic-545862d54af2b210bba725cc655857f7d7068ad9.tar.gz bionic-545862d54af2b210bba725cc655857f7d7068ad9.tar.bz2 |
bionic: 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.
Change-Id: I3b322883cbc48b0d76a0ce9d149b59faaac1dc58
Diffstat (limited to 'libstdc++')
0 files changed, 0 insertions, 0 deletions