diff options
| author | Tom Marshall <tdm@cyngn.com> | 2016-06-17 16:38:12 -0700 |
|---|---|---|
| committer | Tom Marshall <tdm.code@gmail.com> | 2020-11-27 21:11:10 +0100 |
| commit | 6bedb25751933b73083705d227bf472c28d67b89 (patch) | |
| tree | 05b9ec9b0188036142ce56b5ab736d594b0ab884 /libc/stdio/stdio_ext.cpp | |
| parent | 4ff0e09dfbbd14d7b1e865327609718c481d9650 (diff) | |
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.
RM-290
Change-Id: I3b322883cbc48b0d76a0ce9d149b59faaac1dc58
(cherry picked from commit ed4c3a6bd449a4ed70645071a440ae146f194116)
Diffstat (limited to 'libc/stdio/stdio_ext.cpp')
0 files changed, 0 insertions, 0 deletions
