Commit 2ade9d5921e5866ce0d6f92eae2f3bffaef7b060

ckolivas 2014-07-08T15:31:26

There is no point storing the hints addrinfo in struct pool

diff --git a/miner.h b/miner.h
index 58aba3c..c9e31c1 100644
--- a/miner.h
+++ b/miner.h
@@ -1243,7 +1243,6 @@ struct pool {
 	/* Stratum variables */
 	char *stratum_url;
 	char *stratum_port;
-	struct addrinfo stratum_hints;
 	SOCKETTYPE sock;
 	char *sockbuf;
 	size_t sockbuf_size;
diff --git a/util.c b/util.c
index 634e23c..e27bf74 100644
--- a/util.c
+++ b/util.c
@@ -2349,7 +2349,7 @@ static bool sock_connecting(void)
 }
 static bool setup_stratum_socket(struct pool *pool)
 {
-	struct addrinfo servinfobase, *servinfo, *hints, *p;
+	struct addrinfo *servinfo, hints, *p;
 	char *sockaddr_url, *sockaddr_port;
 	int sockd, ret;
 
@@ -2360,11 +2360,9 @@ static bool setup_stratum_socket(struct pool *pool)
 	pool->sock = 0;
 	mutex_unlock(&pool->stratum_lock);
 
-	hints = &pool->stratum_hints;
-	memset(hints, 0, sizeof(struct addrinfo));
-	hints->ai_family = AF_UNSPEC;
-	hints->ai_socktype = SOCK_STREAM;
-	servinfo = &servinfobase;
+	memset(&hints, 0, sizeof(struct addrinfo));
+	hints.ai_family = AF_UNSPEC;
+	hints.ai_socktype = SOCK_STREAM;
 
 	if (!pool->rpc_proxy && opt_socks_proxy) {
 		pool->rpc_proxy = opt_socks_proxy;
@@ -2380,7 +2378,7 @@ static bool setup_stratum_socket(struct pool *pool)
 		sockaddr_port = pool->stratum_port;
 	}
 	mutex_lock(&getaddr_lock);
-	ret = getaddrinfo(sockaddr_url, sockaddr_port, hints, &servinfo);
+	ret = getaddrinfo(sockaddr_url, sockaddr_port, &hints, &servinfo);
 	mutex_unlock(&getaddr_lock);
 	if (ret != 0) {
 		if (!pool->probed) {