From 407be574009b5ae51132144c045a1239425fd754 Mon Sep 17 00:00:00 2001 From: Paul Sheppard Date: Wed, 16 May 2012 16:26:05 -0700 Subject: [PATCH] Change write_config so that pools are saved in priority order. --- cgminer.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/cgminer.c b/cgminer.c index d8b8e6f0..14dfdaa5 100644 --- a/cgminer.c +++ b/cgminer.c @@ -2618,15 +2618,22 @@ void remove_pool(struct pool *pool) void write_config(FILE *fcfg) { - int i; + int i = 0; + int j = 0; - /* Write pool values */ + /* Write pool values in priority order */ fputs("{\n\"pools\" : [", fcfg); - for(i = 0; i < total_pools; i++) { - fprintf(fcfg, "%s\n\t{\n\t\t\"url\" : \"%s\",", i > 0 ? "," : "", pools[i]->rpc_url); - fprintf(fcfg, "\n\t\t\"user\" : \"%s\",", pools[i]->rpc_user); - fprintf(fcfg, "\n\t\t\"pass\" : \"%s\"\n\t}", pools[i]->rpc_pass); - } + while(j < total_pools) { + if(pools[i]->prio == j) { + fprintf(fcfg, "%s\n\t{\n\t\t\"url\" : \"%s\",", i > 0 ? "," : "", pools[i]->rpc_url); + fprintf(fcfg, "\n\t\t\"user\" : \"%s\",", pools[i]->rpc_user); + fprintf(fcfg, "\n\t\t\"pass\" : \"%s\"\n\t}", pools[i]->rpc_pass); + j++; + i=0; + } + else + i++; + } fputs("\n]\n", fcfg); if (nDevs) {