From d211f8e0b050ea24711f58d0948fe82c92db65fa Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Thu, 11 Oct 2012 19:52:40 +1100 Subject: [PATCH] Create a fix-protocol option which prevents cgminer from switching to stratum if it's detected. --- README | 5 ++++- cgminer.c | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README b/README index 18ecc71b..0d17e8af 100644 --- a/README +++ b/README @@ -146,6 +146,7 @@ Options for both config file and command line: --debug|-D Enable debug output --expiry|-E Upper bound on how many seconds after getting work we consider a share from it stale (default: 120) --failover-only Don't leak work to backup pools when primary pool is lagging +--fix-protocol Do not redirect to a different getwork protocol (eg. stratum) --kernel-path|-K Specify a path to where bitstream and kernel files are (default: "/usr/local/bin") --load-balance Change multipool strategy from failover to efficiency based balance --log|-l Interval in seconds between log output (default: 5) @@ -923,7 +924,9 @@ one. If you input the stratum port directly into your configuration, or use the special prefix "stratum+tcp://" instead of "http://", cgminer will ONLY try to use stratum protocol mining. The advantages of stratum to the miner are no delays in getting more work for the miner, less rejects across block changes, -and far less network communications for the same amount of mining hashrate. +and far less network communications for the same amount of mining hashrate. If +you do NOT wish cgminer to automatically switch to stratum protocol even if it +is detected, add the --fix-protocol option. --- diff --git a/cgminer.c b/cgminer.c index 0be058cb..d31a022c 100644 --- a/cgminer.c +++ b/cgminer.c @@ -129,6 +129,7 @@ bool use_curses; static bool opt_submit_stale = true; static int opt_shares; bool opt_fail_only; +static bool opt_fix_protocol; bool opt_autofan; bool opt_autoengine; bool opt_noadl; @@ -893,6 +894,9 @@ static struct opt_table opt_config_table[] = { OPT_WITHOUT_ARG("--failover-only", opt_set_bool, &opt_fail_only, "Don't leak work to backup pools when primary pool is lagging"), + OPT_WITHOUT_ARG("--fix-protocol", + opt_set_bool, &opt_fix_protocol, + "Do not redirect to a different getwork protocol (eg. stratum)"), #ifdef HAVE_OPENCL OPT_WITH_ARG("--gpu-dyninterval", set_int_1_to_65535, opt_show_intval, &opt_dynamic_interval, @@ -4284,7 +4288,7 @@ retry_stratum: /* Detect if a http getwork pool has an X-Stratum header at startup, * and if so, switch to that in preference to getwork if it works */ - if (pool->stratum_url && stratum_works(pool)) { + if (pool->stratum_url && !opt_fix_protocol && stratum_works(pool)) { applog(LOG_NOTICE, "Switching pool %d %s to %s", pool->pool_no, pool->rpc_url, pool->stratum_url); if (!pool->rpc_url) pool->rpc_url = strdup(pool->stratum_url);