Work arround crashing on ~Config.

This commit is contained in:
Arthur Britto
2013-01-18 01:48:55 -08:00
parent e69d309cb3
commit 7688253df9
3 changed files with 18 additions and 9 deletions

View File

@@ -276,6 +276,8 @@ void Config::load()
smtTmp = sectionEntries(secConfig, SECTION_RPC_STARTUP);
if (smtTmp)
{
Json::Value jvArray(Json::arrayValue);
BOOST_FOREACH(const std::string& strJson, *smtTmp)
{
Json::Reader jrReader;
@@ -284,8 +286,10 @@ void Config::load()
if (!jrReader.parse(strJson, jvCommand))
throw std::runtime_error(boost::str(boost::format("Couldn't parse ["SECTION_RPC_STARTUP"] command: %s") % strJson));
RPC_STARTUP.push_back(jvCommand);
RPC_STARTUP.append(jvCommand);
}
RPC_STARTUP = jvArray;
}
if (sectionSingleB(secConfig, SECTION_DATABASE_PATH, DATABASE_PATH))

View File

@@ -118,7 +118,7 @@ public:
std::string RPC_PASSWORD;
std::string RPC_USER;
bool RPC_ALLOW_REMOTE;
std::vector<Json::Value> RPC_STARTUP;
Json::Value RPC_STARTUP;
// Validation
RippleAddress VALIDATION_SEED, VALIDATION_PUB, VALIDATION_PRIV;

View File

@@ -30,16 +30,21 @@ void startServer()
//
// Execute start up rpc commands.
//
BOOST_FOREACH(const Json::Value& jvCommand, theConfig.RPC_STARTUP)
if (theConfig.RPC_STARTUP.isArray())
{
if (!theConfig.QUIET)
cerr << "Startup RPC: " << jvCommand << endl;
for (int i = 0; i != theConfig.RPC_STARTUP.size(); ++i)
{
const Json::Value& jvCommand = theConfig.RPC_STARTUP[i];
RPCHandler rhHandler(&theApp->getOPs());
if (!theConfig.QUIET)
cerr << "Startup RPC: " << jvCommand << endl;
std::cerr << "Result: "
<< rhHandler.doCommand(jvCommand, RPCHandler::ADMIN)
<< std::endl;
RPCHandler rhHandler(&theApp->getOPs());
std::cerr << "Result: "
<< rhHandler.doCommand(jvCommand, RPCHandler::ADMIN)
<< std::endl;
}
}
theApp->run(); // Blocks till we get a stop RPC.