There is no point storing the hints addrinfo in struct pool
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
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) {