Browse Source

RPC: Include a list of config files loaded in "config" reply

Luke Dashjr 11 years ago
parent
commit
d0b3e8ca96
3 changed files with 12 additions and 6 deletions
  1. 2 1
      README.RPC
  2. 8 0
      api.c
  3. 2 5
      miner.c

+ 2 - 1
README.RPC

@@ -164,7 +164,8 @@ The list of requests - a (*) means it requires privileged access - and replies:
                               ScanTime=N, <- --scan-time setting
                               ScanTime=N, <- --scan-time setting
                               Queue=N, <- --queue setting
                               Queue=N, <- --queue setting
                               Expiry=N, <- --expiry setting
                               Expiry=N, <- --expiry setting
-                              Coinbase-Sig=X| <- extra coinbase data in blocks
+                              Coinbase-Sig=X, <- extra coinbase data in blocks
+                              ConfigFileN=X| <- filename of configs loaded
 
 
  summary       SUMMARY        The status summary of the miner
  summary       SUMMARY        The status summary of the miner
                               e.g. Elapsed=NNN,Found Blocks=N,Getworks=N,...|
                               e.g. Elapsed=NNN,Found Blocks=N,Getworks=N,...|

+ 8 - 0
api.c

@@ -1328,6 +1328,14 @@ static void minerconfig(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __
 #if BLKMAKER_VERSION > 0
 #if BLKMAKER_VERSION > 0
 	root = api_add_string(root, "Coinbase-Sig", opt_coinbase_sig, true);
 	root = api_add_string(root, "Coinbase-Sig", opt_coinbase_sig, true);
 #endif
 #endif
+	
+	struct bfg_loaded_configfile *configfile;
+	i = 0;
+	LL_FOREACH(bfg_loaded_configfiles, configfile)
+	{
+		snprintf(buf, sizeof(buf), "ConfigFile%d", i++);
+		root = api_add_string(root, buf, configfile->filename, false);
+	}
 
 
 	root = print_data(root, buf, isjson, false);
 	root = print_data(root, buf, isjson, false);
 	io_add(io_data, buf);
 	io_add(io_data, buf);

+ 2 - 5
miner.c

@@ -12074,8 +12074,8 @@ int main(int argc, char *argv[])
 
 
 	applog(LOG_WARNING, "Started %s", packagename);
 	applog(LOG_WARNING, "Started %s", packagename);
 	{
 	{
-		struct bfg_loaded_configfile *configfile, *tmp_cfgfile;
-		LL_FOREACH_SAFE(bfg_loaded_configfiles, configfile, tmp_cfgfile)
+		struct bfg_loaded_configfile *configfile;
+		LL_FOREACH(bfg_loaded_configfiles, configfile)
 		{
 		{
 			char * const cnfbuf = configfile->filename;
 			char * const cnfbuf = configfile->filename;
 			int fileconf_load = configfile->fileconf_load;
 			int fileconf_load = configfile->fileconf_load;
@@ -12093,9 +12093,6 @@ int main(int argc, char *argv[])
 				default:
 				default:
 					break;
 					break;
 			}
 			}
-			free(cnfbuf);
-			LL_DELETE(bfg_loaded_configfiles, configfile);
-			free(configfile);
 		}
 		}
 	}
 	}