From 3e60a5b819e7f7ae2766be5f7c9a9e2296bd7df1 Mon Sep 17 00:00:00 2001 From: Robert James Kaes Date: Wed, 17 Apr 2002 20:56:13 +0000 Subject: Removed the LOOKUP_LOCK() and LOOKUP_UNLOCK() macros since I believe I need locking around both gethostbyname() and gethostbyaddr() at the same time. --- src/sock.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src') 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 @@ -36,14 +36,6 @@ static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; #define LOCK() pthread_mutex_lock(&mutex); #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; } -- cgit v1.2.3