Browse Source

Store the full stratum url information in rpc_url for correct configuration file saving.

Con Kolivas 13 years ago
parent
commit
0f4cb5c50f
1 changed files with 5 additions and 8 deletions
  1. 5 8
      miner.c

+ 5 - 8
miner.c

@@ -697,6 +697,7 @@ bool detect_stratum(struct pool *pool, char *url)
 		return false;
 		return false;
 
 
 	if (!strncasecmp(url, "stratum+tcp://", 14)) {
 	if (!strncasecmp(url, "stratum+tcp://", 14)) {
+		pool->rpc_url = strdup(url);
 		pool->has_stratum = true;
 		pool->has_stratum = true;
 		pool->stratum_url = pool->sockaddr_url;
 		pool->stratum_url = pool->sockaddr_url;
 		return true;
 		return true;
@@ -714,11 +715,8 @@ static char *set_url(char *arg)
 		add_pool();
 		add_pool();
 	pool = pools[total_urls - 1];
 	pool = pools[total_urls - 1];
 
 
-	if (detect_stratum(pool, arg)) {
-		if (!pool->rpc_url)
-			pool->rpc_url = strdup(pool->stratum_url);
+	if (detect_stratum(pool, arg))
 		return NULL;
 		return NULL;
-	}
 
 
 	opt_set_charp(arg, &pool->rpc_url);
 	opt_set_charp(arg, &pool->rpc_url);
 	if (strncmp(arg, "http://", 7) &&
 	if (strncmp(arg, "http://", 7) &&
@@ -7254,12 +7252,11 @@ static bool input_pool(bool live)
 
 
 	pool = add_pool();
 	pool = add_pool();
 
 
-	if (detect_stratum(pool, url))
-		url = strdup(pool->stratum_url);
-	else if (strncmp(url, "http://", 7) && strncmp(url, "https://", 8)) {
+	if (!detect_stratum(pool, url) && strncmp(url, "http://", 7) &&
+	    strncmp(url, "https://", 8)) {
 		char *httpinput;
 		char *httpinput;
 
 
-		httpinput = malloc(255);
+		httpinput = malloc(256);
 		if (!httpinput)
 		if (!httpinput)
 			quit(1, "Failed to malloc httpinput");
 			quit(1, "Failed to malloc httpinput");
 		strcpy(httpinput, "http://");
 		strcpy(httpinput, "http://");