diff options
author | Robert James Kaes <rjkaes@users.sourceforge.net> | 2002-04-17 20:56:13 +0000 |
---|---|---|
committer | Robert James Kaes <rjkaes@users.sourceforge.net> | 2002-04-17 20:56:13 +0000 |
commit | 3e60a5b819e7f7ae2766be5f7c9a9e2296bd7df1 (patch) | |
tree | 74f75bd1b300bd5a73ac955eed3985cc0bbbdbf8 | |
parent | 1d85484c3a0db1d82fe0c3a186d07fa10055241a (diff) | |
download | tinyproxy-3e60a5b819e7f7ae2766be5f7c9a9e2296bd7df1.tar.gz tinyproxy-3e60a5b819e7f7ae2766be5f7c9a9e2296bd7df1.zip |
Removed the LOOKUP_LOCK() and LOOKUP_UNLOCK() macros since I believe I
need locking around both gethostbyname() and gethostbyaddr() at the same
time.
-rw-r--r-- | src/sock.c | 16 |
1 files changed, 4 insertions, 12 deletions
@@ -1,4 +1,4 @@ -/* $Id: sock.c,v 1.27 2002-04-16 03:21:46 rjkaes Exp $ +/* $Id: sock.c,v 1.28 2002-04-17 20:56:13 rjkaes Exp $ * * Sockets are created and destroyed here. When a new connection comes in from * a client, we need to copy the socket and the create a second socket to the @@ -37,14 +37,6 @@ static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; #define UNLOCK() pthread_mutex_unlock(&mutex); /* - * The mutex is used for locking around accesses to gethostbyname() - * function. - */ -static pthread_mutex_t gethostbyname_mutex = PTHREAD_MUTEX_INITIALIZER; -#define LOOKUP_LOCK() pthread_mutex_lock(&gethostbyname_mutex); -#define LOOKUP_UNLOCK() pthread_mutex_unlock(&gethostbyname_mutex); - -/* * Take a string host address and return a struct in_addr so we can connect * to the remote host. * @@ -67,15 +59,15 @@ lookup_domain(struct in_addr *addr, const char *domain) /* * Okay, it's an alpha-numeric domain, so look it up. */ - LOOKUP_LOCK(); + LOCK(); if (!(resolv = gethostbyname(domain))) { - LOOKUP_UNLOCK(); + UNLOCK(); return -1; } memcpy(addr, resolv->h_addr_list[0], resolv->h_length); - LOOKUP_UNLOCK(); + UNLOCK(); return 0; } |