Commit 35299a7b2dabdf7b8c35ac6a1bfe91b9f9939850

ckolivas 2014-07-08T15:32:25

Wrong fix

diff --git a/cgminer.c b/cgminer.c
index c783327..b0330b3 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -306,7 +306,6 @@ static pthread_mutex_t sshare_lock;
 pthread_rwlock_t netacc_lock;
 pthread_rwlock_t mining_thr_lock;
 pthread_rwlock_t devices_lock;
-pthread_mutex_t getaddr_lock;
 
 static pthread_mutex_t lp_lock;
 static pthread_cond_t lp_cond;
@@ -9262,7 +9261,6 @@ int main(int argc, char *argv[])
 	rwlock_init(&netacc_lock);
 	rwlock_init(&mining_thr_lock);
 	rwlock_init(&devices_lock);
-	mutex_init(&getaddr_lock);
 
 	mutex_init(&lp_lock);
 	if (unlikely(pthread_cond_init(&lp_cond, NULL)))
diff --git a/miner.h b/miner.h
index c9e31c1..74c8345 100644
--- a/miner.h
+++ b/miner.h
@@ -1078,7 +1078,6 @@ extern pthread_mutex_t console_lock;
 extern cglock_t ch_lock;
 extern pthread_rwlock_t mining_thr_lock;
 extern pthread_rwlock_t devices_lock;
-extern pthread_mutex_t getaddr_lock;
 
 extern pthread_mutex_t restart_lock;
 extern pthread_cond_t restart_cond;
diff --git a/util.c b/util.c
index e27bf74..086899a 100644
--- a/util.c
+++ b/util.c
@@ -2240,7 +2240,7 @@ static bool socks4_negotiate(struct pool *pool, int sockd, bool socks4a)
 	unsigned short port;
 	in_addr_t inp;
 	char buf[515];
-	int i, len, ret;
+	int i, len;
 
 	buf[0] = 0x04;
 	buf[1] = 0x01;
@@ -2262,10 +2262,7 @@ static bool socks4_negotiate(struct pool *pool, int sockd, bool socks4a)
 		servinfo = &servinfobase;
 		memset(&hints, 0, sizeof(struct addrinfo));
 		hints.ai_family = AF_INET; /* IPV4 only */
-		mutex_lock(&getaddr_lock);
-		ret = getaddrinfo(pool->sockaddr_url, NULL, &hints, &servinfo);
-		mutex_unlock(&getaddr_lock);
-		if (ret == 0) {
+		if (!getaddrinfo(pool->sockaddr_url, NULL, &hints, &servinfo)) {
 			struct sockaddr_in *saddr_in = (struct sockaddr_in *)servinfo->ai_addr;
 
 			inp = ntohl(saddr_in->sin_addr.s_addr);
@@ -2351,7 +2348,7 @@ static bool setup_stratum_socket(struct pool *pool)
 {
 	struct addrinfo *servinfo, hints, *p;
 	char *sockaddr_url, *sockaddr_port;
-	int sockd, ret;
+	int sockd;
 
 	mutex_lock(&pool->stratum_lock);
 	pool->stratum_active = false;
@@ -2377,10 +2374,7 @@ static bool setup_stratum_socket(struct pool *pool)
 		sockaddr_url = pool->sockaddr_url;
 		sockaddr_port = pool->stratum_port;
 	}
-	mutex_lock(&getaddr_lock);
-	ret = getaddrinfo(sockaddr_url, sockaddr_port, &hints, &servinfo);
-	mutex_unlock(&getaddr_lock);
-	if (ret != 0) {
+	if (getaddrinfo(sockaddr_url, sockaddr_port, &hints, &servinfo) != 0) {
 		if (!pool->probed) {
 			applog(LOG_WARNING, "Failed to resolve (?wrong URL) %s:%s",
 			       sockaddr_url, sockaddr_port);