summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert James Kaes <rjkaes@users.sourceforge.net>2002-04-17 20:56:13 +0000
committerRobert James Kaes <rjkaes@users.sourceforge.net>2002-04-17 20:56:13 +0000
commit3e60a5b819e7f7ae2766be5f7c9a9e2296bd7df1 (patch)
tree74f75bd1b300bd5a73ac955eed3985cc0bbbdbf8 /src
parent1d85484c3a0db1d82fe0c3a186d07fa10055241a (diff)
downloadtinyproxy-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.
Diffstat (limited to '')
-rw-r--r--src/sock.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/sock.c b/src/sock.c
index 27d1a28..e2e29f6 100644
--- a/src/sock.c
+++ b/src/sock.c
@@ -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;
}