mirror of
https://github.com/rofl0r/proxychains-ng.git
synced 2024-12-22 12:18:47 +00:00
af5c6f0c6a
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.
14 lines
214 B
C
14 lines
214 B
C
#include "stringdump.h"
|
|
#include "debug.h"
|
|
|
|
struct stringpool mem;
|
|
|
|
char *dumpstring(char* s, size_t len) {
|
|
PFUNC();
|
|
return stringpool_add(&mem, s, len);
|
|
}
|
|
|
|
void dumpstring_init(void) {
|
|
stringpool_init(&mem);
|
|
}
|