replace hostent lookup with better performing in-memory copy.

the central dns resolver function proxy_gethostbyname() used
to iterate over the gethostent() db (/etc/hosts) on each dns
request.
since this is not threadsafe, we synchronized access to it
previously using mutexes. the parsing of this file is slow,
and blocking all threads to do it even moreso.
since gethostent_r() is only available on a few platforms,
i decided to read the hostent db once and then use a quick
in-memory lookup on further usage.

+ some further refactoring.
This commit is contained in:
rofl0r
2012-11-08 01:18:19 +01:00
parent c698d48c03
commit af5c6f0c6a
11 changed files with 208 additions and 39 deletions

10
src/hash.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef HASH_H
#define HASH_H
#include <stdint.h>
uint32_t dalias_hash(char *s0);
//RcB: DEP "hash.c"
#endif