Browse Source

Implemented the 'remove-pool' config option for json file pools

nfactor-troky
Joe4782 11 years ago
parent
commit
b1eb2ab8f8
  1. 1
      miner.h
  2. 38
      sgminer.c

1
miner.h

@ -1180,6 +1180,7 @@ struct pool {
bool start_disabled; bool start_disabled;
enum pool_enable enabled; enum pool_enable enabled;
bool submit_old; bool submit_old;
bool remove_at_start;
bool removed; bool removed;
bool lp_started; bool lp_started;

38
sgminer.c

@ -765,6 +765,29 @@ static char *set_disable_pool(char *arg)
return NULL; return NULL;
} }
static char *set_remove_pool(char *arg)
{
struct pool *pool;
int len, remove;
while ((json_array_index + 1) > total_pools)
add_pool();
pool = pools[json_array_index];
len = strlen(arg);
if (len < 1)
{
remove = 1;
}
else
{
remove = atoi(arg);
}
pool->remove_at_start = (remove > 0);
return NULL;
}
static char *set_quota(char *arg) static char *set_quota(char *arg)
{ {
char *semicolon = strchr(arg, ';'), *url; char *semicolon = strchr(arg, ';'), *url;
@ -1051,6 +1074,9 @@ static struct opt_table opt_config_table[] = {
OPT_WITH_ARG("--disable-pool", OPT_WITH_ARG("--disable-pool",
set_disable_pool, NULL, NULL, set_disable_pool, NULL, NULL,
"Start the pool in a disabled state, so that it is not automatically chosen for mining"), "Start the pool in a disabled state, so that it is not automatically chosen for mining"),
OPT_WITH_ARG("--remove-pool",
set_remove_pool, NULL, NULL,
"Allow the pool configuration to remain in the config file, but exclude it from the pools available at runtime"),
OPT_WITHOUT_ARG("--disable-rejecting", OPT_WITHOUT_ARG("--disable-rejecting",
opt_set_bool, &opt_disable_pool, opt_set_bool, &opt_disable_pool,
"Automatically disable pools that continually reject shares"), "Automatically disable pools that continually reject shares"),
@ -7878,6 +7904,18 @@ int main(int argc, char *argv[])
if (opt_benchmark) if (opt_benchmark)
goto begin_bench; goto begin_bench;
/* Remove any pools that are in the configuration, but have been marked to be
* removed at miner startup in order to reduce clutter in the pool management */
for (i = 0; i < total_pools; i++) {
struct pool *pool = pools[i];
if (pool->remove_at_start)
{
remove_pool(pool);
}
}
/* Enable or disable all the 'remaining' pools */
for (i = 0; i < total_pools; i++) { for (i = 0; i < total_pools; i++) {
struct pool *pool = pools[i]; struct pool *pool = pools[i];

Loading…
Cancel
Save