mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-27 22:45:52 +00:00
Refactor UniqueNodeList into IUniqueNodeList
This commit is contained in:
@@ -27,16 +27,18 @@ Application::Application ()
|
||||
: mIOService ((theConfig.NODE_SIZE >= 2) ? 2 : 1)
|
||||
, mIOWork (mIOService)
|
||||
, mAuxWork (mAuxService)
|
||||
, mUNL (mIOService)
|
||||
, mNetOps (mIOService, &mLedgerMaster)
|
||||
, mTempNodeCache ("NodeCache", 16384, 90)
|
||||
, mHashedObjectStore (16384, 300)
|
||||
, mSLECache ("LedgerEntryCache", 4096, 120)
|
||||
, mSNTPClient (mAuxService)
|
||||
, mJobQueue (mIOService)
|
||||
// VFALCO: New stuff
|
||||
, mFeeVote (IFeeVote::New (10, 50 * SYSTEM_CURRENCY_PARTS, 12.5 * SYSTEM_CURRENCY_PARTS))
|
||||
, mFeeTrack (ILoadFeeTrack::New ())
|
||||
, mValidations (IValidations::New ())
|
||||
, mUNL (IUniqueNodeList::New (mIOService))
|
||||
// VFALCO: End new stuff
|
||||
, mFeatureTable (2 * 7 * 24 * 60 * 60, 200) // two weeks, 200/256
|
||||
// VFALCO: TODO replace all NULL with nullptr
|
||||
, mRpcDB (NULL)
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "../database/database.h"
|
||||
|
||||
#include "LedgerMaster.h"
|
||||
#include "UniqueNodeList.h"
|
||||
#include "ConnectionPool.h"
|
||||
#include "FeatureTable.h"
|
||||
#include "LedgerAcquire.h"
|
||||
@@ -33,6 +32,7 @@ class IFeatureTable;
|
||||
class IFeeVote;
|
||||
class ILoadFeeTrack;
|
||||
class IValidations;
|
||||
class IUniqueNodeList;
|
||||
|
||||
class RPCDoor;
|
||||
class PeerDoor;
|
||||
@@ -47,7 +47,6 @@ class Application
|
||||
boost::recursive_mutex mMasterLock;
|
||||
|
||||
Wallet mWallet;
|
||||
UniqueNodeList mUNL;
|
||||
LedgerMaster mLedgerMaster;
|
||||
LedgerAcquireMaster mMasterLedgerAcquire;
|
||||
TransactionMaster mMasterTransaction;
|
||||
@@ -67,6 +66,7 @@ class Application
|
||||
beast::ScopedPointer <IFeeVote> mFeeVote;
|
||||
beast::ScopedPointer <ILoadFeeTrack> mFeeTrack;
|
||||
beast::ScopedPointer <IValidations> mValidations;
|
||||
beast::ScopedPointer <IUniqueNodeList> mUNL;
|
||||
// VFALCO: End Clean stuff
|
||||
|
||||
FeatureTable mFeatureTable;
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
|
||||
ConnectionPool& getConnectionPool() { return mConnectionPool; }
|
||||
|
||||
UniqueNodeList& getUNL() { return mUNL; }
|
||||
IUniqueNodeList& getUNL() { return *mUNL; }
|
||||
|
||||
Wallet& getWallet() { return mWallet ; }
|
||||
NetworkOPs& getOPs() { return mNetOps; }
|
||||
|
||||
@@ -291,8 +291,8 @@ void ConnectionPool::connectTo(const std::string& strIp, int iPort)
|
||||
|
||||
db->executeSQL(str(boost::format("REPLACE INTO PeerIps (IpPort,Score,Source,ScanNext) values (%s,%d,'%c',0);")
|
||||
% sqlEscape(str(boost::format("%s %d") % strIp % iPort))
|
||||
% theApp->getUNL().iSourceScore(UniqueNodeList::vsManual)
|
||||
% char(UniqueNodeList::vsManual)));
|
||||
% theApp->getUNL().iSourceScore(IUniqueNodeList::vsManual)
|
||||
% char(IUniqueNodeList::vsManual)));
|
||||
}
|
||||
|
||||
scanRefresh();
|
||||
|
||||
@@ -139,7 +139,7 @@ void HttpsClient::handleDeadline(const boost::system::error_code& ecResult)
|
||||
|
||||
// Mark us as shutting down.
|
||||
// XXX Use our own error code.
|
||||
mShutdown = boost::system::error_code(errc::bad_address, system_category());
|
||||
mShutdown = boost::system::error_code(boost::system::errc::bad_address, boost::system::system_category());
|
||||
|
||||
// Cancel any resolving.
|
||||
mResolver.cancel();
|
||||
@@ -301,7 +301,7 @@ void HttpsClient::handleHeader(const boost::system::error_code& ecResult, std::s
|
||||
{
|
||||
// XXX Use our own error code.
|
||||
WriteLog (lsTRACE, HttpsClient) << "No status code";
|
||||
invokeComplete(boost::system::error_code(errc::bad_address, system_category()));
|
||||
invokeComplete(boost::system::error_code(boost::system::errc::bad_address, boost::system::system_category()));
|
||||
return;
|
||||
}
|
||||
mStatus = lexical_cast_st<int>(smMatch[1]);
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
#ifndef RIPPLE_OFFER_H
|
||||
#define RIPPLE_OFFER_H
|
||||
|
||||
#include "AccountItems.h"
|
||||
|
||||
class Offer : public AccountItem
|
||||
@@ -23,4 +26,6 @@ public:
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// vim:ts=4
|
||||
|
||||
@@ -792,7 +792,7 @@ void Peer::recvHello(ripple::TMHello& packet)
|
||||
// Don't save IP address if the node wants privacy.
|
||||
// Note: We don't go so far as to delete it. If a node which has previously announced itself now wants
|
||||
// privacy, it should at least change its port.
|
||||
theApp->getConnectionPool().savePeer(strIP, iPort, UniqueNodeList::vsInbound);
|
||||
theApp->getConnectionPool().savePeer(strIP, iPort, IUniqueNodeList::vsInbound);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1185,7 +1185,7 @@ void Peer::recvPeers(ripple::TMPeers& packet)
|
||||
{
|
||||
//WriteLog (lsINFO, Peer) << "Peer: Learning: " << ADDRESS(this) << ": " << i << ": " << strIP << " " << iPort;
|
||||
|
||||
theApp->getConnectionPool().savePeer(strIP, iPort, UniqueNodeList::vsTold);
|
||||
theApp->getConnectionPool().savePeer(strIP, iPort, IUniqueNodeList::vsTold);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#ifndef RIPPLE_RPCDOOR_H
|
||||
#define RIPPLE_RPCDOOR_H
|
||||
|
||||
#include "RPCServer.h"
|
||||
#include <boost/asio.hpp>
|
||||
|
||||
/*
|
||||
Handles incoming connections from people making RPC Requests
|
||||
@@ -7,6 +9,11 @@ Handles incoming connections from people making RPC Requests
|
||||
|
||||
class RPCDoor
|
||||
{
|
||||
public:
|
||||
explicit RPCDoor (boost::asio::io_service& io_service);
|
||||
~RPCDoor ();
|
||||
|
||||
private:
|
||||
boost::asio::ip::tcp::acceptor mAcceptor;
|
||||
boost::asio::deadline_timer mDelayTimer;
|
||||
|
||||
@@ -15,7 +22,6 @@ class RPCDoor
|
||||
const boost::system::error_code& error);
|
||||
|
||||
bool isClientAllowed(const std::string& ip);
|
||||
public:
|
||||
RPCDoor(boost::asio::io_service& io_service);
|
||||
~RPCDoor();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2391,13 +2391,13 @@ Json::Value RPCHandler::doUnlAdd(Json::Value jvRequest, int& cost, ScopedLock& M
|
||||
|
||||
if (raNodePublic.setNodePublic(strNode))
|
||||
{
|
||||
theApp->getUNL().nodeAddPublic(raNodePublic, UniqueNodeList::vsManual, strComment);
|
||||
theApp->getUNL().nodeAddPublic(raNodePublic, IUniqueNodeList::vsManual, strComment);
|
||||
|
||||
return "adding node by public key";
|
||||
}
|
||||
else
|
||||
{
|
||||
theApp->getUNL().nodeAddDomain(strNode, UniqueNodeList::vsManual, strComment);
|
||||
theApp->getUNL().nodeAddDomain(strNode, IUniqueNodeList::vsManual, strComment);
|
||||
|
||||
return "adding node by domain";
|
||||
}
|
||||
|
||||
@@ -1,167 +0,0 @@
|
||||
#ifndef __UNIQUE_NODE_LIST__
|
||||
#define __UNIQUE_NODE_LIST__
|
||||
|
||||
#include <deque>
|
||||
#include <set>
|
||||
|
||||
#include <boost/thread/recursive_mutex.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include <boost/unordered_set.hpp>
|
||||
|
||||
#include "Config.h"
|
||||
#include "HttpsClient.h"
|
||||
#include "ParseSection.h"
|
||||
|
||||
// Guarantees minimum throughput of 1 node per second.
|
||||
#define NODE_FETCH_JOBS 10
|
||||
#define NODE_FETCH_SECONDS 10
|
||||
#define NODE_FILE_BYTES_MAX (50<<10) // 50k
|
||||
#define NODE_FILE_NAME SYSTEM_NAME ".txt"
|
||||
#define NODE_FILE_PATH "/" NODE_FILE_NAME
|
||||
|
||||
// Wait for validation information to be stable before scoring.
|
||||
// #define SCORE_DELAY_SECONDS 20
|
||||
#define SCORE_DELAY_SECONDS 5
|
||||
|
||||
// Don't bother propagating past this number of rounds.
|
||||
#define SCORE_ROUNDS 10
|
||||
|
||||
class UniqueNodeList
|
||||
{
|
||||
public:
|
||||
typedef enum {
|
||||
vsConfig = 'C', // rippled.cfg
|
||||
vsInbound = 'I',
|
||||
vsManual = 'M',
|
||||
vsReferral = 'R',
|
||||
vsTold = 'T',
|
||||
vsValidator = 'V', // validators.txt
|
||||
vsWeb = 'W',
|
||||
} validatorSource;
|
||||
|
||||
typedef long score;
|
||||
|
||||
private:
|
||||
// Misc persistent information
|
||||
boost::posix_time::ptime mtpScoreUpdated;
|
||||
boost::posix_time::ptime mtpFetchUpdated;
|
||||
|
||||
boost::recursive_mutex mUNLLock;
|
||||
// XXX Make this faster, make this the contents vector unsigned char or raw public key.
|
||||
// XXX Contents needs to based on score.
|
||||
boost::unordered_set<std::string> mUNL;
|
||||
|
||||
bool miscLoad();
|
||||
bool miscSave();
|
||||
|
||||
typedef struct {
|
||||
std::string strDomain;
|
||||
RippleAddress naPublicKey;
|
||||
validatorSource vsSource;
|
||||
boost::posix_time::ptime tpNext;
|
||||
boost::posix_time::ptime tpScan;
|
||||
boost::posix_time::ptime tpFetch;
|
||||
uint256 iSha256;
|
||||
std::string strComment;
|
||||
} seedDomain;
|
||||
|
||||
typedef struct {
|
||||
RippleAddress naPublicKey;
|
||||
validatorSource vsSource;
|
||||
boost::posix_time::ptime tpNext;
|
||||
boost::posix_time::ptime tpScan;
|
||||
boost::posix_time::ptime tpFetch;
|
||||
uint256 iSha256;
|
||||
std::string strComment;
|
||||
} seedNode;
|
||||
|
||||
// Used to distribute scores.
|
||||
typedef struct {
|
||||
int iScore;
|
||||
int iRoundScore;
|
||||
int iRoundSeed;
|
||||
int iSeen;
|
||||
std::string strValidator; // The public key.
|
||||
std::vector<int> viReferrals;
|
||||
} scoreNode;
|
||||
|
||||
std::map<RippleAddress, std::string> sClusterNodes;
|
||||
|
||||
typedef boost::unordered_map<std::string,int> strIndex;
|
||||
typedef std::pair<std::string,int> ipPort;
|
||||
typedef boost::unordered_map<std::pair< std::string, int>, score> epScore;
|
||||
|
||||
void trustedLoad();
|
||||
|
||||
bool scoreRound(std::vector<scoreNode>& vsnNodes);
|
||||
|
||||
bool responseFetch(const std::string& strDomain, const boost::system::error_code& err, int iStatus, const std::string& strSiteFile);
|
||||
|
||||
boost::posix_time::ptime mtpScoreNext; // When to start scoring.
|
||||
boost::posix_time::ptime mtpScoreStart; // Time currently started scoring.
|
||||
boost::asio::deadline_timer mdtScoreTimer; // Timer to start scoring.
|
||||
|
||||
void scoreNext(bool bNow); // Update scoring timer.
|
||||
void scoreCompute();
|
||||
void scoreTimerHandler(const boost::system::error_code& err);
|
||||
|
||||
boost::mutex mFetchLock;
|
||||
int mFetchActive; // Count of active fetches.
|
||||
|
||||
boost::posix_time::ptime mtpFetchNext; // Time of to start next fetch.
|
||||
boost::asio::deadline_timer mdtFetchTimer; // Timer to start fetching.
|
||||
|
||||
void fetchNext();
|
||||
void fetchDirty();
|
||||
void fetchFinish();
|
||||
void fetchProcess(std::string strDomain);
|
||||
void fetchTimerHandler(const boost::system::error_code& err);
|
||||
|
||||
void getValidatorsUrl(const RippleAddress& naNodePublic, section secSite);
|
||||
void getIpsUrl(const RippleAddress& naNodePublic, section secSite);
|
||||
bool responseIps(const std::string& strSite, const RippleAddress& naNodePublic, const boost::system::error_code& err, int iStatus, const std::string& strIpsFile);
|
||||
bool responseValidators(const std::string& strValidatorsUrl, const RippleAddress& naNodePublic, section secSite, const std::string& strSite, const boost::system::error_code& err, int iStatus, const std::string& strValidatorsFile);
|
||||
|
||||
void processIps(const std::string& strSite, const RippleAddress& naNodePublic, section::mapped_type* pmtVecStrIps);
|
||||
int processValidators(const std::string& strSite, const std::string& strValidatorsSrc, const RippleAddress& naNodePublic, validatorSource vsWhy, section::mapped_type* pmtVecStrValidators);
|
||||
|
||||
void processFile(const std::string& strDomain, const RippleAddress& naNodePublic, section secSite);
|
||||
|
||||
bool getSeedDomains(const std::string& strDomain, seedDomain& dstSeedDomain);
|
||||
void setSeedDomains(const seedDomain& dstSeedDomain, bool bNext);
|
||||
|
||||
bool getSeedNodes(const RippleAddress& naNodePublic, seedNode& dstSeedNode);
|
||||
void setSeedNodes(const seedNode& snSource, bool bNext);
|
||||
|
||||
bool validatorsResponse(const boost::system::error_code& err, int iStatus, const std::string strResponse);
|
||||
void nodeProcess(const std::string& strSite, const std::string& strValidators, const std::string& strSource);
|
||||
|
||||
public:
|
||||
UniqueNodeList(boost::asio::io_service& io_service);
|
||||
|
||||
// Begin processing.
|
||||
void start();
|
||||
|
||||
void nodeAddPublic(const RippleAddress& naNodePublic, validatorSource vsWhy, const std::string& strComment);
|
||||
void nodeAddDomain(std::string strDomain, validatorSource vsWhy, const std::string& strComment="");
|
||||
void nodeRemovePublic(const RippleAddress& naNodePublic);
|
||||
void nodeRemoveDomain(std::string strDomain);
|
||||
void nodeReset();
|
||||
|
||||
void nodeScore();
|
||||
|
||||
bool nodeInUNL(const RippleAddress& naNodePublic);
|
||||
bool nodeInCluster(const RippleAddress& naNodePublic);
|
||||
bool nodeInCluster(const RippleAddress& naNodePublic, std::string& name);
|
||||
|
||||
void nodeBootstrap();
|
||||
bool nodeLoad(boost::filesystem::path pConfig);
|
||||
void nodeNetwork();
|
||||
|
||||
Json::Value getUnlJson();
|
||||
|
||||
int iSourceScore(validatorSource vsWhy);
|
||||
};
|
||||
|
||||
#endif
|
||||
// vim:ts=4
|
||||
53
src/cpp/ripple/ripple_IUniqueNodeList.h
Normal file
53
src/cpp/ripple/ripple_IUniqueNodeList.h
Normal file
@@ -0,0 +1,53 @@
|
||||
#ifndef RIPPLE_IUNIQUENODELIST_H
|
||||
#define RIPPLE_IUNIQUENODELIST_H
|
||||
|
||||
class IUniqueNodeList
|
||||
{
|
||||
public:
|
||||
typedef enum {
|
||||
vsConfig = 'C', // rippled.cfg
|
||||
vsInbound = 'I',
|
||||
vsManual = 'M',
|
||||
vsReferral = 'R',
|
||||
vsTold = 'T',
|
||||
vsValidator = 'V', // validators.txt
|
||||
vsWeb = 'W',
|
||||
} validatorSource;
|
||||
|
||||
// VFALCO: TODO, rename this to use the right coding style
|
||||
typedef long score;
|
||||
|
||||
public:
|
||||
// VFALCO: TODO, make this not use boost::asio...
|
||||
static IUniqueNodeList* New (boost::asio::io_service& io_service);
|
||||
|
||||
virtual ~IUniqueNodeList () { }
|
||||
|
||||
// VFALCO: TODO, Roll this into the constructor so there is one less state.
|
||||
virtual void start () = 0;
|
||||
|
||||
// VFALCO: TODO, rename all these, the "node" prefix is redundant (lol)
|
||||
virtual void nodeAddPublic (const RippleAddress& naNodePublic, validatorSource vsWhy, const std::string& strComment) = 0;
|
||||
virtual void nodeAddDomain(std::string strDomain, validatorSource vsWhy, const std::string& strComment="") = 0;
|
||||
virtual void nodeRemovePublic(const RippleAddress& naNodePublic) = 0;
|
||||
virtual void nodeRemoveDomain(std::string strDomain) = 0;
|
||||
virtual void nodeReset() = 0;
|
||||
|
||||
virtual void nodeScore() = 0;
|
||||
|
||||
virtual bool nodeInUNL(const RippleAddress& naNodePublic) = 0;
|
||||
virtual bool nodeInCluster(const RippleAddress& naNodePublic) = 0;
|
||||
virtual bool nodeInCluster(const RippleAddress& naNodePublic, std::string& name) = 0;
|
||||
|
||||
virtual void nodeBootstrap () = 0;
|
||||
virtual bool nodeLoad (boost::filesystem::path pConfig) = 0;
|
||||
virtual void nodeNetwork () = 0;
|
||||
|
||||
virtual Json::Value getUnlJson () = 0;
|
||||
|
||||
virtual int iSourceScore (validatorSource vsWhy) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// vim:ts=4
|
||||
@@ -1,24 +1,146 @@
|
||||
// XXX Dynamically limit fetching by distance.
|
||||
// XXX Want a limit of 2000 validators.
|
||||
|
||||
#include "UniqueNodeList.h"
|
||||
// Guarantees minimum throughput of 1 node per second.
|
||||
#define NODE_FETCH_JOBS 10
|
||||
#define NODE_FETCH_SECONDS 10
|
||||
#define NODE_FILE_BYTES_MAX (50<<10) // 50k
|
||||
#define NODE_FILE_NAME SYSTEM_NAME ".txt"
|
||||
#define NODE_FILE_PATH "/" NODE_FILE_NAME
|
||||
|
||||
#include <algorithm>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
// Wait for validation information to be stable before scoring.
|
||||
// #define SCORE_DELAY_SECONDS 20
|
||||
#define SCORE_DELAY_SECONDS 5
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/mem_fn.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
// Don't bother propagating past this number of rounds.
|
||||
#define SCORE_ROUNDS 10
|
||||
|
||||
#include "Application.h"
|
||||
#include "HttpsClient.h"
|
||||
#include "ParseSection.h"
|
||||
// VFALCO: TODO, move all function definitions inlined into the class.
|
||||
class UniqueNodeList : public IUniqueNodeList
|
||||
{
|
||||
private:
|
||||
// Misc persistent information
|
||||
boost::posix_time::ptime mtpScoreUpdated;
|
||||
boost::posix_time::ptime mtpFetchUpdated;
|
||||
|
||||
boost::recursive_mutex mUNLLock;
|
||||
// XXX Make this faster, make this the contents vector unsigned char or raw public key.
|
||||
// XXX Contents needs to based on score.
|
||||
boost::unordered_set<std::string> mUNL;
|
||||
|
||||
bool miscLoad();
|
||||
bool miscSave();
|
||||
|
||||
typedef struct {
|
||||
std::string strDomain;
|
||||
RippleAddress naPublicKey;
|
||||
validatorSource vsSource;
|
||||
boost::posix_time::ptime tpNext;
|
||||
boost::posix_time::ptime tpScan;
|
||||
boost::posix_time::ptime tpFetch;
|
||||
uint256 iSha256;
|
||||
std::string strComment;
|
||||
} seedDomain;
|
||||
|
||||
typedef struct {
|
||||
RippleAddress naPublicKey;
|
||||
validatorSource vsSource;
|
||||
boost::posix_time::ptime tpNext;
|
||||
boost::posix_time::ptime tpScan;
|
||||
boost::posix_time::ptime tpFetch;
|
||||
uint256 iSha256;
|
||||
std::string strComment;
|
||||
} seedNode;
|
||||
|
||||
// Used to distribute scores.
|
||||
typedef struct {
|
||||
int iScore;
|
||||
int iRoundScore;
|
||||
int iRoundSeed;
|
||||
int iSeen;
|
||||
std::string strValidator; // The public key.
|
||||
std::vector<int> viReferrals;
|
||||
} scoreNode;
|
||||
|
||||
std::map<RippleAddress, std::string> sClusterNodes;
|
||||
|
||||
typedef boost::unordered_map<std::string,int> strIndex;
|
||||
typedef std::pair<std::string,int> ipPort;
|
||||
typedef boost::unordered_map<std::pair< std::string, int>, score> epScore;
|
||||
|
||||
void trustedLoad();
|
||||
|
||||
bool scoreRound(std::vector<scoreNode>& vsnNodes);
|
||||
|
||||
bool responseFetch(const std::string& strDomain, const boost::system::error_code& err, int iStatus, const std::string& strSiteFile);
|
||||
|
||||
boost::posix_time::ptime mtpScoreNext; // When to start scoring.
|
||||
boost::posix_time::ptime mtpScoreStart; // Time currently started scoring.
|
||||
boost::asio::deadline_timer mdtScoreTimer; // Timer to start scoring.
|
||||
|
||||
void scoreNext(bool bNow); // Update scoring timer.
|
||||
void scoreCompute();
|
||||
void scoreTimerHandler(const boost::system::error_code& err);
|
||||
|
||||
boost::mutex mFetchLock;
|
||||
int mFetchActive; // Count of active fetches.
|
||||
|
||||
boost::posix_time::ptime mtpFetchNext; // Time of to start next fetch.
|
||||
boost::asio::deadline_timer mdtFetchTimer; // Timer to start fetching.
|
||||
|
||||
void fetchNext();
|
||||
void fetchDirty();
|
||||
void fetchFinish();
|
||||
void fetchProcess(std::string strDomain);
|
||||
void fetchTimerHandler(const boost::system::error_code& err);
|
||||
|
||||
void getValidatorsUrl(const RippleAddress& naNodePublic, section secSite);
|
||||
void getIpsUrl(const RippleAddress& naNodePublic, section secSite);
|
||||
bool responseIps(const std::string& strSite, const RippleAddress& naNodePublic, const boost::system::error_code& err, int iStatus, const std::string& strIpsFile);
|
||||
bool responseValidators(const std::string& strValidatorsUrl, const RippleAddress& naNodePublic, section secSite, const std::string& strSite, const boost::system::error_code& err, int iStatus, const std::string& strValidatorsFile);
|
||||
|
||||
void processIps(const std::string& strSite, const RippleAddress& naNodePublic, section::mapped_type* pmtVecStrIps);
|
||||
int processValidators(const std::string& strSite, const std::string& strValidatorsSrc, const RippleAddress& naNodePublic, validatorSource vsWhy, section::mapped_type* pmtVecStrValidators);
|
||||
|
||||
void processFile(const std::string& strDomain, const RippleAddress& naNodePublic, section secSite);
|
||||
|
||||
bool getSeedDomains(const std::string& strDomain, seedDomain& dstSeedDomain);
|
||||
void setSeedDomains(const seedDomain& dstSeedDomain, bool bNext);
|
||||
|
||||
bool getSeedNodes(const RippleAddress& naNodePublic, seedNode& dstSeedNode);
|
||||
void setSeedNodes(const seedNode& snSource, bool bNext);
|
||||
|
||||
bool validatorsResponse(const boost::system::error_code& err, int iStatus, const std::string strResponse);
|
||||
void nodeProcess(const std::string& strSite, const std::string& strValidators, const std::string& strSource);
|
||||
|
||||
public:
|
||||
UniqueNodeList(boost::asio::io_service& io_service);
|
||||
|
||||
// Begin processing.
|
||||
void start();
|
||||
|
||||
void nodeAddPublic(const RippleAddress& naNodePublic, validatorSource vsWhy, const std::string& strComment);
|
||||
void nodeAddDomain(std::string strDomain, validatorSource vsWhy, const std::string& strComment="");
|
||||
void nodeRemovePublic(const RippleAddress& naNodePublic);
|
||||
void nodeRemoveDomain(std::string strDomain);
|
||||
void nodeReset();
|
||||
|
||||
void nodeScore();
|
||||
|
||||
bool nodeInUNL(const RippleAddress& naNodePublic);
|
||||
bool nodeInCluster(const RippleAddress& naNodePublic);
|
||||
bool nodeInCluster(const RippleAddress& naNodePublic, std::string& name);
|
||||
|
||||
void nodeBootstrap();
|
||||
bool nodeLoad(boost::filesystem::path pConfig);
|
||||
void nodeNetwork();
|
||||
|
||||
Json::Value getUnlJson();
|
||||
|
||||
int iSourceScore(validatorSource vsWhy);
|
||||
};
|
||||
|
||||
// VFALCO: TODO Replace macros with language constructs
|
||||
#define VALIDATORS_FETCH_SECONDS 30
|
||||
#define VALIDATORS_FILE_BYTES_MAX (50 << 10)
|
||||
|
||||
@@ -38,7 +160,7 @@
|
||||
|
||||
SETUP_LOG (UniqueNodeList)
|
||||
|
||||
UniqueNodeList::UniqueNodeList(boost::asio::io_service& io_service) :
|
||||
UniqueNodeList::UniqueNodeList (boost::asio::io_service& io_service) :
|
||||
mdtScoreTimer(io_service),
|
||||
mFetchActive(0),
|
||||
mdtFetchTimer(io_service)
|
||||
@@ -1743,4 +1865,9 @@ bool UniqueNodeList::nodeInCluster(const RippleAddress& naNodePublic, std::strin
|
||||
return true;
|
||||
}
|
||||
|
||||
IUniqueNodeList* IUniqueNodeList::New (boost::asio::io_service& io_service)
|
||||
{
|
||||
return new UniqueNodeList (io_service);
|
||||
}
|
||||
|
||||
// vim:ts=4
|
||||
Reference in New Issue
Block a user