mirror of
https://github.com/rofl0r/proxychains-ng.git
synced 2025-09-06 00:37:01 +00:00
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:
12
src/stringdump.h
Normal file
12
src/stringdump.h
Normal file
@ -0,0 +1,12 @@
|
||||
#ifndef STRINGDUMP_H
|
||||
#define STRINGDUMP_H
|
||||
|
||||
#include "shm.h"
|
||||
#include <unistd.h>
|
||||
|
||||
char *dumpstring(char* s, size_t len);
|
||||
void dumpstring_init(void);
|
||||
|
||||
//RcB: DEP "stringdump.h"
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user