Browse Source

Store a sockaddr url of the stripped url used in determining sockaddr to not confuse it with the stratum url and fix build warnings.

nfactor-troky
Con Kolivas 12 years ago
parent
commit
2941febd05
  1. 9
      cgminer.c
  2. 1
      miner.h
  3. 7
      util.c

9
cgminer.c

@ -5594,9 +5594,9 @@ static bool input_pool(bool live) @@ -5594,9 +5594,9 @@ static bool input_pool(bool live)
pool = add_pool();
if (!detect_stratum(pool, url) &&
strncmp(url, "http://", 7) &&
strncmp(url, "https://", 8)) {
if (detect_stratum(pool, url))
url = strdup(pool->stratum_url);
else if (strncmp(url, "http://", 7) && strncmp(url, "https://", 8)) {
char *httpinput;
httpinput = malloc(255);
@ -5606,8 +5606,7 @@ static bool input_pool(bool live) @@ -5606,8 +5606,7 @@ static bool input_pool(bool live)
strncat(httpinput, url, 248);
free(url);
url = httpinput;
} else
url = strdup(pool->stratum_url);
}
add_pool_details(pool, live, url, user, pass);
ret = true;

1
miner.h

@ -834,6 +834,7 @@ struct pool { @@ -834,6 +834,7 @@ struct pool {
char *stratum_url;
SOCKETTYPE sock;
struct sockaddr_in *server, client;
char *sockaddr_url; /* stripped url used for sockaddr */
char *subscription;
char *nonce1;
uint32_t nonce2;

7
util.c

@ -809,7 +809,7 @@ double tdiff(struct timeval *end, struct timeval *start) @@ -809,7 +809,7 @@ double tdiff(struct timeval *end, struct timeval *start)
bool extract_sockaddr(struct pool *pool, char *url)
{
char *url_begin, *url_end, *port_start;
char *url_begin, *url_end, *port_start = NULL;
char *url_address, *port;
struct addrinfo hints, *res;
int url_len, port_len = 0;
@ -854,7 +854,7 @@ bool extract_sockaddr(struct pool *pool, char *url) @@ -854,7 +854,7 @@ bool extract_sockaddr(struct pool *pool, char *url)
}
pool->server = (struct sockaddr_in *)res->ai_addr;
pool->stratum_url = strdup(url_address);
pool->sockaddr_url = strdup(url_address);
return true;
}
@ -1188,7 +1188,7 @@ out: @@ -1188,7 +1188,7 @@ out:
bool initiate_stratum(struct pool *pool)
{
json_t *val, *res_val, *err_val, *notify_val;
json_t *val = NULL, *res_val, *err_val, *notify_val;
char *s, *buf, *sret = NULL;
json_error_t err;
bool ret = false;
@ -1281,6 +1281,7 @@ out: @@ -1281,6 +1281,7 @@ out:
json_decref(val);
if (ret) {
pool->stratum_url = pool->sockaddr_url;
pool->stratum_active = true;
pool->swork.diff = 1;
if (opt_protocol) {

Loading…
Cancel
Save