remove THREAD_SAFE ifdefs. from now on, pthreads are required.

additionally we have some explicit init and deinit routines for
core.c now, so that we dont need to share variables with
libproxychains.c.
This commit is contained in:
rofl0r
2012-11-07 21:28:09 +01:00
parent bd07ca49b9
commit 03ee84060e
4 changed files with 27 additions and 18 deletions

View File

@ -34,10 +34,8 @@
#include <sys/time.h>
#include <stdarg.h>
#include <assert.h>
#ifdef THREAD_SAFE
#include <pthread.h>
#include "mutex.h"
pthread_mutex_t hostdb_lock;
#endif
#include "core.h"
#include "common.h"
@ -692,6 +690,14 @@ int connect_proxy_chain(int sock, ip_type target_ip,
return -1;
}
void core_initialize(void) {
MUTEX_INIT(&hostdb_lock);
}
void core_unload(void) {
MUTEX_DESTROY(&hostdb_lock);
}
static void gethostbyname_data_setstring(struct gethostbyname_data* data, char* name) {
snprintf(data->addr_name, sizeof(data->addr_name), "%s", name);
data->hostent_space.h_name = data->addr_name;