mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-25 05:25:55 +00:00
Refactor UniqueNodeList into IUniqueNodeList
This commit is contained in:
@@ -23,28 +23,3 @@
|
||||
*/
|
||||
|
||||
#include "ripple_client.h"
|
||||
|
||||
#include "../ripple_data/ripple_data.h"
|
||||
|
||||
// VFALCO: TODO, fix these warnings!
|
||||
#ifdef _MSC_VER
|
||||
//#pragma warning (push) // Causes spurious C4503 "decorated name exceeds maximum length"
|
||||
#pragma warning (disable: 4018) // signed/unsigned mismatch
|
||||
#pragma warning (disable: 4244) // conversion, possible loss of data
|
||||
#pragma warning (disable: 4309) // truncation of constant value
|
||||
#endif
|
||||
|
||||
#include "src/cpp/ripple/HTTPRequest.cpp"
|
||||
#include "src/cpp/ripple/HttpsClient.cpp"
|
||||
|
||||
#include "src/cpp/ripple/CallRPC.cpp"
|
||||
#include "src/cpp/ripple/rpc.cpp"
|
||||
#include "src/cpp/ripple/RPCDoor.cpp"
|
||||
#include "src/cpp/ripple/RPCErr.cpp"
|
||||
#include "src/cpp/ripple/RPCHandler.cpp"
|
||||
#include "src/cpp/ripple/RPCServer.cpp"
|
||||
#include "src/cpp/ripple/RPCSub.cpp"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
//#pragma warning (pop)
|
||||
#endif
|
||||
|
||||
@@ -130,7 +130,8 @@
|
||||
#include "src/cpp/ripple/ripple_IFeeVote.h"
|
||||
#include "src/cpp/ripple/ripple_ILoadFeeTrack.h"
|
||||
#include "src/cpp/ripple/ripple_IValidations.h"
|
||||
#include "src/cpp/ripple/FeatureTable.h"
|
||||
#include "src/cpp/ripple/ripple_IUniqueNodeList.h"
|
||||
#include "src/cpp/ripple/FeatureTable.h" // ??
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -238,7 +239,6 @@ static DH* handleTmpDh(SSL* ssl, int is_export, int iKeyLength)
|
||||
|
||||
// sockets
|
||||
#include "src/cpp/ripple/Suppression.cpp" // no log
|
||||
#include "src/cpp/ripple/UniqueNodeList.cpp"
|
||||
#include "src/cpp/ripple/SNTPClient.cpp"
|
||||
#include "src/cpp/ripple/ConnectionPool.cpp"
|
||||
#include "src/cpp/ripple/NetworkOPs.cpp"
|
||||
@@ -247,6 +247,19 @@ static DH* handleTmpDh(SSL* ssl, int is_export, int iKeyLength)
|
||||
#include "src/cpp/ripple/WSDoor.cpp" // uses logging in WSConnection.h
|
||||
#include "src/cpp/ripple/ripple_LogWebsockets.cpp"
|
||||
|
||||
// http
|
||||
#include "src/cpp/ripple/HTTPRequest.cpp"
|
||||
#include "src/cpp/ripple/HttpsClient.cpp"
|
||||
|
||||
// rpc
|
||||
#include "src/cpp/ripple/CallRPC.cpp"
|
||||
#include "src/cpp/ripple/rpc.cpp"
|
||||
#include "src/cpp/ripple/RPCDoor.cpp"
|
||||
#include "src/cpp/ripple/RPCErr.cpp"
|
||||
#include "src/cpp/ripple/RPCHandler.cpp"
|
||||
#include "src/cpp/ripple/RPCServer.cpp"
|
||||
#include "src/cpp/ripple/RPCSub.cpp"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// Implementation of interfaces
|
||||
@@ -254,6 +267,7 @@ static DH* handleTmpDh(SSL* ssl, int is_export, int iKeyLength)
|
||||
#include "src/cpp/ripple/ripple_FeeVote.cpp"
|
||||
#include "src/cpp/ripple/ripple_LoadFeeTrack.cpp"
|
||||
#include "src/cpp/ripple/ripple_Validations.cpp"
|
||||
#include "src/cpp/ripple/ripple_UniqueNodeList.cpp"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -992,6 +992,12 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\ripple_UniqueNodeList.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\ripple_Validations.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
@@ -1172,12 +1178,6 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\UniqueNodeList.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\UpdateTables.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
@@ -1657,6 +1657,7 @@
|
||||
<ClInclude Include="src\cpp\ripple\ripple_IFeatures.h" />
|
||||
<ClInclude Include="src\cpp\ripple\ripple_IFeeVote.h" />
|
||||
<ClInclude Include="src\cpp\ripple\ripple_ILoadFeeTrack.h" />
|
||||
<ClInclude Include="src\cpp\ripple\ripple_IUniqueNodeList.h" />
|
||||
<ClInclude Include="src\cpp\ripple\ripple_IValidations.h" />
|
||||
<ClInclude Include="src\cpp\ripple\RPC.h" />
|
||||
<ClInclude Include="src\cpp\ripple\RPCDoor.h" />
|
||||
@@ -1683,7 +1684,6 @@
|
||||
<ClInclude Include="src\cpp\ripple\TransactionQueue.h" />
|
||||
<ClInclude Include="src\cpp\ripple\Transactor.h" />
|
||||
<ClInclude Include="src\cpp\ripple\TrustSetTransactor.h" />
|
||||
<ClInclude Include="src\cpp\ripple\UniqueNodeList.h" />
|
||||
<ClInclude Include="src\cpp\ripple\Version.h" />
|
||||
<ClInclude Include="src\cpp\ripple\Wallet.h" />
|
||||
<ClInclude Include="src\cpp\ripple\WalletAddTransactor.h" />
|
||||
|
||||
@@ -52,24 +52,15 @@
|
||||
<Filter Include="1. Modules\ripple_basics">
|
||||
<UniqueIdentifier>{84e43f43-816e-4ccd-80c2-38b322904894}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="1. Modules\ripple_client">
|
||||
<UniqueIdentifier>{97c96b68-70fd-4679-89fc-c1c8c87c265e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="1. Modules\ripple_db">
|
||||
<UniqueIdentifier>{a5190241-c5bc-4e23-8ef1-6adf757c75e3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="1. Modules\ripple_main">
|
||||
<UniqueIdentifier>{1a379c07-ccf1-4636-8018-2cfc0685edf0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="1. Modules\ripple_client\rpc">
|
||||
<UniqueIdentifier>{3f351c55-360d-40bc-a136-4944ce572efd}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="1. Modules\ripple_db\storage">
|
||||
<UniqueIdentifier>{6097a179-ddad-4c69-9a34-2e3fc2c9fa1d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="1. Modules\ripple_client\http">
|
||||
<UniqueIdentifier>{29cd2103-d553-4d82-9e6a-224e3b1cb667}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="1. Modules\ripple_basics\containers">
|
||||
<UniqueIdentifier>{96cbc9ff-0118-4844-bb4c-05aef58a60b5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
@@ -139,6 +130,15 @@
|
||||
<Filter Include="2. Empty\ripple_net">
|
||||
<UniqueIdentifier>{7f76ce57-c428-487e-97a0-979c0990a81d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="1. Modules\ripple_main\rpc">
|
||||
<UniqueIdentifier>{3f351c55-360d-40bc-a136-4944ce572efd}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="1. Modules\ripple_main\http">
|
||||
<UniqueIdentifier>{29cd2103-d553-4d82-9e6a-224e3b1cb667}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="2. Empty\ripple_client">
|
||||
<UniqueIdentifier>{97c96b68-70fd-4679-89fc-c1c8c87c265e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\cpp\database\sqlite3.c">
|
||||
@@ -565,25 +565,25 @@
|
||||
<Filter>1. Modules\ripple_main\processing</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\CallRPC.cpp">
|
||||
<Filter>1. Modules\ripple_client\rpc</Filter>
|
||||
<Filter>1. Modules\ripple_main\rpc</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\rpc.cpp">
|
||||
<Filter>1. Modules\ripple_client\rpc</Filter>
|
||||
<Filter>1. Modules\ripple_main\rpc</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\RPCDoor.cpp">
|
||||
<Filter>1. Modules\ripple_client\rpc</Filter>
|
||||
<Filter>1. Modules\ripple_main\rpc</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\RPCErr.cpp">
|
||||
<Filter>1. Modules\ripple_client\rpc</Filter>
|
||||
<Filter>1. Modules\ripple_main\rpc</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\RPCHandler.cpp">
|
||||
<Filter>1. Modules\ripple_client\rpc</Filter>
|
||||
<Filter>1. Modules\ripple_main\rpc</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\RPCSub.cpp">
|
||||
<Filter>1. Modules\ripple_client\rpc</Filter>
|
||||
<Filter>1. Modules\ripple_main\rpc</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_client\ripple_client.cpp">
|
||||
<Filter>1. Modules\ripple_client</Filter>
|
||||
<Filter>2. Empty\ripple_client</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\ChangeTransactor.cpp">
|
||||
<Filter>1. Modules\ripple_main\transactions</Filter>
|
||||
@@ -592,7 +592,7 @@
|
||||
<Filter>1. Modules\ripple_main\transactions</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\RPCServer.cpp">
|
||||
<Filter>1. Modules\ripple_client\rpc</Filter>
|
||||
<Filter>1. Modules\ripple_main\rpc</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_db\ripple_db.cpp">
|
||||
<Filter>1. Modules\ripple_db</Filter>
|
||||
@@ -610,10 +610,10 @@
|
||||
<Filter>1. Modules\ripple_main</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\HttpsClient.cpp">
|
||||
<Filter>1. Modules\ripple_client\http</Filter>
|
||||
<Filter>1. Modules\ripple_main\http</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\HTTPRequest.cpp">
|
||||
<Filter>1. Modules\ripple_client\http</Filter>
|
||||
<Filter>1. Modules\ripple_main\http</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="modules\ripple_net\ripple_net.cpp">
|
||||
<Filter>2. Empty\ripple_net</Filter>
|
||||
@@ -789,9 +789,6 @@
|
||||
<ClCompile Include="src\cpp\ripple\Suppression.cpp">
|
||||
<Filter>1. Modules\ripple_main\sockets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\UniqueNodeList.cpp">
|
||||
<Filter>1. Modules\ripple_main\sockets</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\WSDoor.cpp">
|
||||
<Filter>1. Modules\ripple_main\sockets</Filter>
|
||||
</ClCompile>
|
||||
@@ -801,6 +798,9 @@
|
||||
<ClCompile Include="Subtrees\beast\modules\beast_core\beast_core.cpp">
|
||||
<Filter>0. Third Party Code\beast</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\cpp\ripple\ripple_UniqueNodeList.cpp">
|
||||
<Filter>1. Modules\ripple_main\sockets</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="database\sqlite3ext.h">
|
||||
@@ -1215,28 +1215,28 @@
|
||||
<Filter>1. Modules\ripple_main\processing</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\WSHandler.h">
|
||||
<Filter>1. Modules\ripple_client\rpc</Filter>
|
||||
<Filter>1. Modules\ripple_main\rpc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\CallRPC.h">
|
||||
<Filter>1. Modules\ripple_client\rpc</Filter>
|
||||
<Filter>1. Modules\ripple_main\rpc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\RPC.h">
|
||||
<Filter>1. Modules\ripple_client\rpc</Filter>
|
||||
<Filter>1. Modules\ripple_main\rpc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\RPCDoor.h">
|
||||
<Filter>1. Modules\ripple_client\rpc</Filter>
|
||||
<Filter>1. Modules\ripple_main\rpc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\RPCErr.h">
|
||||
<Filter>1. Modules\ripple_client\rpc</Filter>
|
||||
<Filter>1. Modules\ripple_main\rpc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\RPCHandler.h">
|
||||
<Filter>1. Modules\ripple_client\rpc</Filter>
|
||||
<Filter>1. Modules\ripple_main\rpc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\RPCSub.h">
|
||||
<Filter>1. Modules\ripple_client\rpc</Filter>
|
||||
<Filter>1. Modules\ripple_main\rpc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="modules\ripple_client\ripple_client.h">
|
||||
<Filter>1. Modules\ripple_client</Filter>
|
||||
<Filter>2. Empty\ripple_client</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\ChangeTransactor.h">
|
||||
<Filter>1. Modules\ripple_main\transactions</Filter>
|
||||
@@ -1245,7 +1245,7 @@
|
||||
<Filter>1. Modules\ripple_main\transactions</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\RPCServer.h">
|
||||
<Filter>1. Modules\ripple_client\rpc</Filter>
|
||||
<Filter>1. Modules\ripple_main\rpc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="modules\ripple_db\ripple_db.h">
|
||||
<Filter>1. Modules\ripple_db</Filter>
|
||||
@@ -1260,10 +1260,10 @@
|
||||
<Filter>1. Modules\ripple_main</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\HttpsClient.h">
|
||||
<Filter>1. Modules\ripple_client\http</Filter>
|
||||
<Filter>1. Modules\ripple_main\http</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\HTTPRequest.h">
|
||||
<Filter>1. Modules\ripple_client\http</Filter>
|
||||
<Filter>1. Modules\ripple_main\http</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="modules\ripple_net\ripple_net.h">
|
||||
<Filter>2. Empty\ripple_net</Filter>
|
||||
@@ -1481,10 +1481,10 @@
|
||||
<ClInclude Include="src\cpp\ripple\Suppression.h">
|
||||
<Filter>1. Modules\ripple_main\sockets</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\UniqueNodeList.h">
|
||||
<ClInclude Include="src\cpp\ripple\WSConnection.h">
|
||||
<Filter>1. Modules\ripple_main\sockets</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\cpp\ripple\WSConnection.h">
|
||||
<ClInclude Include="src\cpp\ripple\ripple_IUniqueNodeList.h">
|
||||
<Filter>1. Modules\ripple_main\sockets</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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