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

1
miner.h

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

7
util.c

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

Loading…
Cancel
Save