mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Use regexes to parse cluster entries.
This commit is contained in:
@@ -96,22 +96,18 @@ bool UniqueNodeList::miscSave()
|
|||||||
|
|
||||||
void UniqueNodeList::trustedLoad()
|
void UniqueNodeList::trustedLoad()
|
||||||
{
|
{
|
||||||
|
boost::regex rNode("\\`\\s*(\\S+)[\\s]*(.*)\\'");
|
||||||
BOOST_FOREACH(const std::string& c, theConfig.CLUSTER_NODES)
|
BOOST_FOREACH(const std::string& c, theConfig.CLUSTER_NODES)
|
||||||
{
|
{
|
||||||
std::string node, name;
|
boost::smatch match;
|
||||||
size_t s = c.find(' ');
|
if (boost::regex_match(c, match, rNode))
|
||||||
if (s != std::string::npos)
|
|
||||||
{
|
{
|
||||||
name = c.substr(s+1);
|
RippleAddress a = RippleAddress::createNodePublic(match[1]);
|
||||||
node = c.substr(0, s);
|
if (a.isValid())
|
||||||
|
sClusterNodes.insert(std::make_pair(a, (match.size() > 1) ? match[2] : std::string("")));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
node = c;
|
cLog(lsWARNING) << "Entry in cluster list invalid: '" << c << "'";
|
||||||
RippleAddress a = RippleAddress::createNodePublic(node);
|
|
||||||
if (a.isValid())
|
|
||||||
sClusterNodes.insert(std::make_pair(a, name));
|
|
||||||
else
|
|
||||||
cLog(lsWARNING) << "Entry in cluster list invalid: '" << node << "'";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Database* db=theApp->getWalletDB()->getDB();
|
Database* db=theApp->getWalletDB()->getDB();
|
||||||
|
|||||||
Reference in New Issue
Block a user