Browse Source

Merge branch 'master' into idlebug

idlebug
elbandi 10 years ago
parent
commit
78e7b2f22d
  1. 1
      api.c
  2. 1
      configure.ac
  3. 1
      miner.h
  4. 18
      sgminer.c
  5. 13
      util.c

1
api.c

@ -27,6 +27,7 @@ @@ -27,6 +27,7 @@
#include "compat.h"
#include "miner.h"
#include "pool.h"
#include "util.h"
// BUFSIZ varies on Windows and Linux

1
configure.ac

@ -258,6 +258,7 @@ if test "x$have_sgminer_sdk" = "xtrue"; then @@ -258,6 +258,7 @@ if test "x$have_sgminer_sdk" = "xtrue"; then
fi
PKG_CONFIG="${PKG_CONFIG:-pkg-config} --define-variable=arch=$ARCH_DIR --define-variable=target=$target --define-variable=sgminersdkdir=$SGMINER_SDK"
PKG_CONFIG_PATH="$SGMINER_SDK/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
export PKG_CONFIG_PATH
fi
AC_ARG_ENABLE([libcurl],

1
miner.h

@ -1175,6 +1175,7 @@ struct pool { @@ -1175,6 +1175,7 @@ struct pool {
char *name;
char *description;
int prio;
bool extranonce_subscribe;
int accepted, rejected;
int seq_rejects;
int seq_getfails;

18
sgminer.c

@ -151,7 +151,6 @@ bool opt_api_network; @@ -151,7 +151,6 @@ bool opt_api_network;
bool opt_delaynet;
bool opt_disable_pool;
bool opt_disable_client_reconnect = false;
bool opt_extranonce_subscribe = true;
static bool no_work;
bool opt_worktime;
#if defined(HAVE_LIBCURL) && defined(CURL_HAS_KEEPALIVE)
@ -563,6 +562,7 @@ struct pool *add_pool(void) @@ -563,6 +562,7 @@ struct pool *add_pool(void)
pool->rpc_proxy = NULL;
pool->quota = 1;
adjust_quota_gcd();
pool->extranonce_subscribe = true;
pool->description = "";
@ -951,6 +951,16 @@ static char *set_userpass(const char *arg) @@ -951,6 +951,16 @@ static char *set_userpass(const char *arg)
return NULL;
}
static char *set_no_extranonce_subscribe(char *arg)
{
struct pool *pool = get_current_pool();
applog(LOG_DEBUG, "Disable extranonce subscribe on %d", pool->pool_no);
opt_set_invbool(&pool->extranonce_subscribe);
return NULL;
}
static char *set_pool_priority(char *arg)
{
struct pool *pool = get_current_pool();
@ -1329,7 +1339,7 @@ static struct opt_table opt_config_table[] = { @@ -1329,7 +1339,7 @@ static struct opt_table opt_config_table[] = {
opt_set_invbool, &opt_submit_stale,
"Don't submit shares if they are detected as stale"),
OPT_WITHOUT_ARG("--no-extranonce-subscribe",
opt_set_invbool, &opt_extranonce_subscribe,
set_no_extranonce_subscribe, NULL,
"Disable 'extranonce' stratum subscribe"),
OPT_WITH_ARG("--pass|-p",
set_pass, NULL, NULL,
@ -4302,6 +4312,8 @@ void write_config(FILE *fcfg) @@ -4302,6 +4312,8 @@ void write_config(FILE *fcfg)
pool->rpc_proxy ? "|" : "",
json_escape(pool->rpc_url));
}
if (!pool->extranonce_subscribe)
fputs("\n\t\t\"no-extranonce-subscribe\" : true,", fcfg);
fprintf(fcfg, "\n\t\t\"user\" : \"%s\",", json_escape(pool->rpc_user));
fprintf(fcfg, "\n\t\t\"pass\" : \"%s\",", json_escape(pool->rpc_pass));
/* Using get_pool_name() here is unsafe if opt_incognito is true. */
@ -5687,7 +5699,7 @@ retry_stratum: @@ -5687,7 +5699,7 @@ retry_stratum:
bool init = pool_tset(pool, &pool->stratum_init);
if (!init) {
bool ret = initiate_stratum(pool) && (!opt_extranonce_subscribe || subscribe_extranonce(pool)) && auth_stratum(pool);
bool ret = initiate_stratum(pool) && (!pool->extranonce_subscribe || subscribe_extranonce(pool)) && auth_stratum(pool);
if (ret)
init_stratum_threads(pool);

13
util.c

@ -1907,8 +1907,15 @@ bool subscribe_extranonce(struct pool *pool) @@ -1907,8 +1907,15 @@ bool subscribe_extranonce(struct pool *pool)
char *ss;
if (err_val) {
ss = (char *)json_string_value(json_array_get(err_val, 1));
if (opt_extranonce_subscribe && strcmp(ss, "Method 'subscribe' not found for service 'mining.extranonce'") == 0) {
ss = __json_array_string(err_val, 1);
if (!ss)
ss = (char *)json_string_value(err_val);
if (ss && (strcmp(ss, "Method 'subscribe' not found for service 'mining.extranonce'") == 0)) {
applog(LOG_INFO, "Cannot subscribe to mining.extranonce on %s", get_pool_name(pool));
ret = true;
goto out;
}
if (ss && (strcmp(ss, "Unrecognized request provided") == 0)) {
applog(LOG_INFO, "Cannot subscribe to mining.extranonce on %s", get_pool_name(pool));
ret = true;
goto out;
@ -2561,7 +2568,7 @@ bool restart_stratum(struct pool *pool) @@ -2561,7 +2568,7 @@ bool restart_stratum(struct pool *pool)
suspend_stratum(pool);
if (!initiate_stratum(pool))
return false;
if (opt_extranonce_subscribe && !subscribe_extranonce(pool))
if (pool->extranonce_subscribe && !subscribe_extranonce(pool))
return false;
if (!auth_stratum(pool))
return false;

Loading…
Cancel
Save