mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-26 22:15:52 +00:00
Rename LedgerAcquire to InboundLedger
This commit is contained in:
@@ -10,6 +10,8 @@ TODO
|
|||||||
- Replace uint160, uint256 in argument lists, template parameter lists, and
|
- Replace uint160, uint256 in argument lists, template parameter lists, and
|
||||||
data members with tyepdefs from ripple_ProtocolTypes.h
|
data members with tyepdefs from ripple_ProtocolTypes.h
|
||||||
|
|
||||||
|
- Consolidate SQLite database classes: DatabaseCon, Database, SqliteDatabase.
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
LoadEvent
|
LoadEvent
|
||||||
@@ -27,11 +29,15 @@ Naming
|
|||||||
|
|
||||||
Some names don't make sense.
|
Some names don't make sense.
|
||||||
|
|
||||||
LedgerAcquire
|
InboundLedger
|
||||||
Not a noun.
|
Not a noun.
|
||||||
Is it really an InboundLedger ?
|
Is it really an InboundLedger ?
|
||||||
Does it continue to exist after the ledger is received?
|
Does it continue to exist after the ledger is received?
|
||||||
|
|
||||||
|
Index
|
||||||
|
Stop using Index to refer to keys in tables.
|
||||||
|
Index implies a small integer, or a data structure.
|
||||||
|
|
||||||
Inconsistent names
|
Inconsistent names
|
||||||
|
|
||||||
We have full names like SerializedType and then acronyms like STObject
|
We have full names like SerializedType and then acronyms like STObject
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "../ripple_data/ripple_data.h"
|
#include "../ripple_data/ripple_data.h"
|
||||||
|
|
||||||
|
/*
|
||||||
#include "src/cpp/ripple/ripple_InfoSub.h"
|
#include "src/cpp/ripple/ripple_InfoSub.h"
|
||||||
|
|
||||||
// Order and indentation reflect the hierarchy of dependencies
|
// Order and indentation reflect the hierarchy of dependencies
|
||||||
@@ -46,7 +47,7 @@
|
|||||||
#include "src/cpp/ripple/ripple_LoadManager.h"
|
#include "src/cpp/ripple/ripple_LoadManager.h"
|
||||||
#include "src/cpp/ripple/ripple_Peer.h"
|
#include "src/cpp/ripple/ripple_Peer.h"
|
||||||
#include "src/cpp/ripple/ripple_PeerSet.h"
|
#include "src/cpp/ripple/ripple_PeerSet.h"
|
||||||
#include "src/cpp/ripple/ripple_LedgerAcquire.h"
|
#include "src/cpp/ripple/ripple_InboundLedger.h"
|
||||||
#include "src/cpp/ripple/ripple_LedgerHistory.h"
|
#include "src/cpp/ripple/ripple_LedgerHistory.h"
|
||||||
#include "src/cpp/ripple/ripple_CanonicalTXSet.h"
|
#include "src/cpp/ripple/ripple_CanonicalTXSet.h"
|
||||||
#include "src/cpp/ripple/LedgerMaster.h"
|
#include "src/cpp/ripple/LedgerMaster.h"
|
||||||
@@ -56,6 +57,5 @@
|
|||||||
#include "src/cpp/ripple/ripple_AcceptedLedgerTx.h"
|
#include "src/cpp/ripple/ripple_AcceptedLedgerTx.h"
|
||||||
#include "src/cpp/ripple/NetworkOPs.h"
|
#include "src/cpp/ripple/NetworkOPs.h"
|
||||||
#include "src/cpp/ripple/ripple_IApplication.h"
|
#include "src/cpp/ripple/ripple_IApplication.h"
|
||||||
|
|
||||||
#include "src/cpp/ripple/ripple_InfoSub.cpp"
|
|
||||||
//#include "src/cpp/ripple/NetworkOPs.cpp"
|
//#include "src/cpp/ripple/NetworkOPs.cpp"
|
||||||
|
*/
|
||||||
|
|||||||
@@ -149,8 +149,8 @@
|
|||||||
#include "src/cpp/ripple/ripple_IValidations.h"
|
#include "src/cpp/ripple/ripple_IValidations.h"
|
||||||
|
|
||||||
#include "src/cpp/ripple/ripple_PeerSet.h"
|
#include "src/cpp/ripple/ripple_PeerSet.h"
|
||||||
#include "src/cpp/ripple/ripple_LedgerAcquire.h"
|
#include "src/cpp/ripple/ripple_InboundLedger.h"
|
||||||
#include "src/cpp/ripple/ripple_LedgerAcquireMaster.h"
|
#include "src/cpp/ripple/ripple_InboundLedgers.h"
|
||||||
|
|
||||||
#include "src/cpp/database/database.h"
|
#include "src/cpp/database/database.h"
|
||||||
#include "src/cpp/database/SqliteDatabase.h"
|
#include "src/cpp/database/SqliteDatabase.h"
|
||||||
@@ -375,8 +375,9 @@ static DH* handleTmpDh (SSL* ssl, int is_export, int iKeyLength)
|
|||||||
|
|
||||||
#include "src/cpp/ripple/ripple_Job.cpp"
|
#include "src/cpp/ripple/ripple_Job.cpp"
|
||||||
#include "src/cpp/ripple/ripple_JobQueue.cpp"
|
#include "src/cpp/ripple/ripple_JobQueue.cpp"
|
||||||
#include "src/cpp/ripple/ripple_LedgerAcquire.cpp"
|
#include "src/cpp/ripple/ripple_InboundLedger.cpp"
|
||||||
#include "src/cpp/ripple/ripple_LedgerAcquireMaster.cpp"
|
#include "src/cpp/ripple/ripple_InboundLedgers.cpp"
|
||||||
|
#include "src/cpp/ripple/ripple_InfoSub.cpp"
|
||||||
#include "src/cpp/ripple/ripple_LedgerConsensus.cpp"
|
#include "src/cpp/ripple/ripple_LedgerConsensus.cpp"
|
||||||
#include "src/cpp/ripple/ripple_LedgerHistory.cpp"
|
#include "src/cpp/ripple/ripple_LedgerHistory.cpp"
|
||||||
#include "src/cpp/ripple/ripple_LoadEvent.cpp"
|
#include "src/cpp/ripple/ripple_LoadEvent.cpp"
|
||||||
|
|||||||
@@ -827,7 +827,7 @@
|
|||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="src\cpp\ripple\ripple_LedgerAcquireMaster.cpp">
|
<ClCompile Include="src\cpp\ripple\ripple_InboundLedgers.cpp">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
@@ -879,7 +879,7 @@
|
|||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="src\cpp\ripple\ripple_LedgerAcquire.cpp">
|
<ClCompile Include="src\cpp\ripple\ripple_InboundLedger.cpp">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
@@ -1770,7 +1770,7 @@
|
|||||||
<ClInclude Include="src\cpp\ripple\HttpsClient.h" />
|
<ClInclude Include="src\cpp\ripple\HttpsClient.h" />
|
||||||
<ClInclude Include="src\cpp\ripple\Interpreter.h" />
|
<ClInclude Include="src\cpp\ripple\Interpreter.h" />
|
||||||
<ClInclude Include="src\cpp\ripple\Ledger.h" />
|
<ClInclude Include="src\cpp\ripple\Ledger.h" />
|
||||||
<ClInclude Include="src\cpp\ripple\ripple_LedgerAcquire.h" />
|
<ClInclude Include="src\cpp\ripple\ripple_InboundLedger.h" />
|
||||||
<ClInclude Include="src\cpp\ripple\ripple_LedgerConsensus.h" />
|
<ClInclude Include="src\cpp\ripple\ripple_LedgerConsensus.h" />
|
||||||
<ClInclude Include="src\cpp\ripple\ripple_LedgerEntrySet.h" />
|
<ClInclude Include="src\cpp\ripple\ripple_LedgerEntrySet.h" />
|
||||||
<ClInclude Include="src\cpp\ripple\ripple_LedgerHistory.h" />
|
<ClInclude Include="src\cpp\ripple\ripple_LedgerHistory.h" />
|
||||||
@@ -1780,7 +1780,7 @@
|
|||||||
<ClInclude Include="src\cpp\ripple\ripple_LoadManager.h" />
|
<ClInclude Include="src\cpp\ripple\ripple_LoadManager.h" />
|
||||||
<ClInclude Include="src\cpp\ripple\ripple_Job.h" />
|
<ClInclude Include="src\cpp\ripple\ripple_Job.h" />
|
||||||
<ClInclude Include="src\cpp\ripple\ripple_JobQueue.h" />
|
<ClInclude Include="src\cpp\ripple\ripple_JobQueue.h" />
|
||||||
<ClInclude Include="src\cpp\ripple\ripple_LedgerAcquireMaster.h" />
|
<ClInclude Include="src\cpp\ripple\ripple_InboundLedgers.h" />
|
||||||
<ClInclude Include="src\cpp\ripple\ripple_LoadMonitor.h" />
|
<ClInclude Include="src\cpp\ripple\ripple_LoadMonitor.h" />
|
||||||
<ClInclude Include="src\cpp\ripple\NetworkOPs.h" />
|
<ClInclude Include="src\cpp\ripple\NetworkOPs.h" />
|
||||||
<ClInclude Include="src\cpp\ripple\ripple_NicknameState.h" />
|
<ClInclude Include="src\cpp\ripple\ripple_NicknameState.h" />
|
||||||
|
|||||||
@@ -148,6 +148,9 @@
|
|||||||
<Filter Include="1. Modules\ripple_main\refactored\pathing">
|
<Filter Include="1. Modules\ripple_main\refactored\pathing">
|
||||||
<UniqueIdentifier>{90a5527e-0de0-4d5f-a731-b6b196a013b5}</UniqueIdentifier>
|
<UniqueIdentifier>{90a5527e-0de0-4d5f-a731-b6b196a013b5}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="1. Modules\ripple_main\refactored\ledger">
|
||||||
|
<UniqueIdentifier>{857187f0-ff25-4ebe-af30-544b7b7f503a}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="src\cpp\database\sqlite3.c">
|
<ClCompile Include="src\cpp\database\sqlite3.c">
|
||||||
@@ -747,15 +750,6 @@
|
|||||||
<ClCompile Include="src\cpp\ripple\ripple_PeerSet.cpp">
|
<ClCompile Include="src\cpp\ripple\ripple_PeerSet.cpp">
|
||||||
<Filter>1. Modules\ripple_main\refactored</Filter>
|
<Filter>1. Modules\ripple_main\refactored</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="src\cpp\ripple\ripple_LedgerAcquireMaster.cpp">
|
|
||||||
<Filter>1. Modules\ripple_main\refactored</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="src\cpp\ripple\ripple_LedgerAcquire.cpp">
|
|
||||||
<Filter>1. Modules\ripple_main\refactored</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="src\cpp\ripple\ripple_LedgerHistory.cpp">
|
|
||||||
<Filter>1. Modules\ripple_main\refactored</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="src\cpp\ripple\ripple_CanonicalTXSet.cpp">
|
<ClCompile Include="src\cpp\ripple\ripple_CanonicalTXSet.cpp">
|
||||||
<Filter>1. Modules\ripple_main\refactored</Filter>
|
<Filter>1. Modules\ripple_main\refactored</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -883,7 +877,16 @@
|
|||||||
<Filter>1. Modules\ripple_main\refactored</Filter>
|
<Filter>1. Modules\ripple_main\refactored</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="src\cpp\ripple\ripple_LedgerEntrySet.cpp">
|
<ClCompile Include="src\cpp\ripple\ripple_LedgerEntrySet.cpp">
|
||||||
<Filter>1. Modules\ripple_main\_unfactored\ledger</Filter>
|
<Filter>1. Modules\ripple_main\refactored\ledger</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\cpp\ripple\ripple_LedgerHistory.cpp">
|
||||||
|
<Filter>1. Modules\ripple_main\refactored\ledger</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\cpp\ripple\ripple_InboundLedger.cpp">
|
||||||
|
<Filter>1. Modules\ripple_main\refactored\ledger</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\cpp\ripple\ripple_InboundLedgers.cpp">
|
||||||
|
<Filter>1. Modules\ripple_main\refactored\ledger</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -1511,18 +1514,9 @@
|
|||||||
<ClInclude Include="src\cpp\ripple\ripple_PeerSet.h">
|
<ClInclude Include="src\cpp\ripple\ripple_PeerSet.h">
|
||||||
<Filter>1. Modules\ripple_main\refactored</Filter>
|
<Filter>1. Modules\ripple_main\refactored</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="src\cpp\ripple\ripple_LedgerAcquireMaster.h">
|
|
||||||
<Filter>1. Modules\ripple_main\refactored</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="modules\ripple_basics\types\ripple_BasicTypes.h">
|
<ClInclude Include="modules\ripple_basics\types\ripple_BasicTypes.h">
|
||||||
<Filter>1. Modules\ripple_basics\types</Filter>
|
<Filter>1. Modules\ripple_basics\types</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="src\cpp\ripple\ripple_LedgerAcquire.h">
|
|
||||||
<Filter>1. Modules\ripple_main\refactored</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="src\cpp\ripple\ripple_LedgerHistory.h">
|
|
||||||
<Filter>1. Modules\ripple_main\refactored</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="src\cpp\ripple\ripple_CanonicalTXSet.h">
|
<ClInclude Include="src\cpp\ripple\ripple_CanonicalTXSet.h">
|
||||||
<Filter>1. Modules\ripple_main\refactored</Filter>
|
<Filter>1. Modules\ripple_main\refactored</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
@@ -1647,7 +1641,16 @@
|
|||||||
<Filter>1. Modules\ripple_main\refactored</Filter>
|
<Filter>1. Modules\ripple_main\refactored</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="src\cpp\ripple\ripple_LedgerEntrySet.h">
|
<ClInclude Include="src\cpp\ripple\ripple_LedgerEntrySet.h">
|
||||||
<Filter>1. Modules\ripple_main\_unfactored\ledger</Filter>
|
<Filter>1. Modules\ripple_main\refactored\ledger</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\cpp\ripple\ripple_LedgerHistory.h">
|
||||||
|
<Filter>1. Modules\ripple_main\refactored\ledger</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\cpp\ripple\ripple_InboundLedger.h">
|
||||||
|
<Filter>1. Modules\ripple_main\refactored\ledger</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\cpp\ripple\ripple_InboundLedgers.h">
|
||||||
|
<Filter>1. Modules\ripple_main\refactored\ledger</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -12,15 +12,6 @@ struct sqlite3_stmt;
|
|||||||
|
|
||||||
class SqliteDatabase : public Database
|
class SqliteDatabase : public Database
|
||||||
{
|
{
|
||||||
sqlite3* mConnection;
|
|
||||||
sqlite3* mAuxConnection;
|
|
||||||
sqlite3_stmt* mCurrentStmt;
|
|
||||||
bool mMoreRows;
|
|
||||||
|
|
||||||
boost::mutex walMutex;
|
|
||||||
JobQueue* mWalQ;
|
|
||||||
bool walRunning;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SqliteDatabase (const char* host);
|
SqliteDatabase (const char* host);
|
||||||
|
|
||||||
@@ -67,6 +58,16 @@ public:
|
|||||||
|
|
||||||
int getKBUsedDB ();
|
int getKBUsedDB ();
|
||||||
int getKBUsedAll ();
|
int getKBUsedAll ();
|
||||||
|
|
||||||
|
private:
|
||||||
|
sqlite3* mConnection;
|
||||||
|
sqlite3* mAuxConnection;
|
||||||
|
sqlite3_stmt* mCurrentStmt;
|
||||||
|
bool mMoreRows;
|
||||||
|
|
||||||
|
boost::mutex walMutex;
|
||||||
|
JobQueue* mWalQ;
|
||||||
|
bool walRunning;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SqliteStatement
|
class SqliteStatement
|
||||||
|
|||||||
@@ -277,13 +277,13 @@ bool LedgerMaster::acquireMissingLedger (Ledger::ref origLedger, uint256 const&
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theApp->getMasterLedgerAcquire ().isFailure (ledgerHash))
|
if (theApp->getInboundLedgers ().isFailure (ledgerHash))
|
||||||
{
|
{
|
||||||
WriteLog (lsTRACE, LedgerMaster) << "Already failed to acquire " << ledgerSeq;
|
WriteLog (lsTRACE, LedgerMaster) << "Already failed to acquire " << ledgerSeq;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mMissingLedger = theApp->getMasterLedgerAcquire ().findCreate (ledgerHash, ledgerSeq);
|
mMissingLedger = theApp->getInboundLedgers ().findCreate (ledgerHash, ledgerSeq);
|
||||||
|
|
||||||
if (mMissingLedger->isComplete ())
|
if (mMissingLedger->isComplete ())
|
||||||
{
|
{
|
||||||
@@ -311,7 +311,7 @@ bool LedgerMaster::acquireMissingLedger (Ledger::ref origLedger, uint256 const&
|
|||||||
|
|
||||||
int fetchMax = theConfig.getSize (siLedgerFetch);
|
int fetchMax = theConfig.getSize (siLedgerFetch);
|
||||||
int timeoutCount;
|
int timeoutCount;
|
||||||
int fetchCount = theApp->getMasterLedgerAcquire ().getFetchCount (timeoutCount);
|
int fetchCount = theApp->getInboundLedgers ().getFetchCount (timeoutCount);
|
||||||
|
|
||||||
if ((fetchCount < fetchMax) && theApp->getOPs ().isFull ())
|
if ((fetchCount < fetchMax) && theApp->getOPs ().isFull ())
|
||||||
{
|
{
|
||||||
@@ -326,9 +326,9 @@ bool LedgerMaster::acquireMissingLedger (Ledger::ref origLedger, uint256 const&
|
|||||||
BOOST_REVERSE_FOREACH (const u_pair & it, vec)
|
BOOST_REVERSE_FOREACH (const u_pair & it, vec)
|
||||||
{
|
{
|
||||||
if ((fetchCount < fetchMax) && (it.first < ledgerSeq) &&
|
if ((fetchCount < fetchMax) && (it.first < ledgerSeq) &&
|
||||||
!mCompleteLedgers.hasValue (it.first) && !theApp->getMasterLedgerAcquire ().find (it.second))
|
!mCompleteLedgers.hasValue (it.first) && !theApp->getInboundLedgers ().find (it.second))
|
||||||
{
|
{
|
||||||
LedgerAcquire::pointer acq = theApp->getMasterLedgerAcquire ().findCreate (it.second, it.first);
|
InboundLedger::pointer acq = theApp->getInboundLedgers ().findCreate (it.second, it.first);
|
||||||
|
|
||||||
if (acq && acq->isComplete ())
|
if (acq && acq->isComplete ())
|
||||||
{
|
{
|
||||||
@@ -384,7 +384,7 @@ bool LedgerMaster::acquireMissingLedger (Ledger::ref origLedger, uint256 const&
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LedgerMaster::missingAcquireComplete (LedgerAcquire::pointer acq)
|
void LedgerMaster::missingAcquireComplete (InboundLedger::pointer acq)
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock ml (mLock);
|
boost::recursive_mutex::scoped_lock ml (mLock);
|
||||||
|
|
||||||
@@ -418,6 +418,12 @@ bool LedgerMaster::shouldAcquire (uint32 currentLedger, uint32 ledgerHistory, ui
|
|||||||
|
|
||||||
void LedgerMaster::resumeAcquiring ()
|
void LedgerMaster::resumeAcquiring ()
|
||||||
{
|
{
|
||||||
|
// VFALCO NOTE These returns from the middle are troubling. You might think
|
||||||
|
// that calling a function called "resumeAcquiring" would
|
||||||
|
// actually resume acquiring. But it doesn't always resume acquiring,
|
||||||
|
// based on a myriad of conditions which short circuit the function
|
||||||
|
// in ways that the caller cannot expect or predict.
|
||||||
|
//
|
||||||
if (!theApp->getOPs ().isFull ())
|
if (!theApp->getOPs ().isFull ())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -525,7 +531,7 @@ void LedgerMaster::setFullLedger (Ledger::pointer ledger)
|
|||||||
if (mMissingLedger && mMissingLedger->isDone ())
|
if (mMissingLedger && mMissingLedger->isDone ())
|
||||||
{
|
{
|
||||||
if (mMissingLedger->isFailed ())
|
if (mMissingLedger->isFailed ())
|
||||||
theApp->getMasterLedgerAcquire ().dropLedger (mMissingLedger->getHash ());
|
theApp->getInboundLedgers ().dropLedger (mMissingLedger->getHash ());
|
||||||
|
|
||||||
mMissingLedger.reset ();
|
mMissingLedger.reset ();
|
||||||
}
|
}
|
||||||
@@ -628,7 +634,7 @@ void LedgerMaster::checkAccept (uint256 const& hash, uint32 seq)
|
|||||||
|
|
||||||
if (!ledger)
|
if (!ledger)
|
||||||
{
|
{
|
||||||
theApp->getMasterLedgerAcquire ().findCreate (hash, seq);
|
theApp->getInboundLedgers ().findCreate (hash, seq);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -689,13 +695,13 @@ void LedgerMaster::tryPublish ()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (theApp->getMasterLedgerAcquire ().isFailure (hash))
|
if (theApp->getInboundLedgers ().isFailure (hash))
|
||||||
{
|
{
|
||||||
WriteLog (lsWARNING, LedgerMaster) << "Unable to acquire a recent validated ledger";
|
WriteLog (lsWARNING, LedgerMaster) << "Unable to acquire a recent validated ledger";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LedgerAcquire::pointer acq = theApp->getMasterLedgerAcquire ().findCreate (hash, seq);
|
InboundLedger::pointer acq = theApp->getInboundLedgers ().findCreate (hash, seq);
|
||||||
|
|
||||||
if (!acq->isDone ())
|
if (!acq->isDone ())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ private:
|
|||||||
|
|
||||||
bool acquireMissingLedger (Ledger::ref from, uint256 const& ledgerHash, uint32 ledgerSeq);
|
bool acquireMissingLedger (Ledger::ref from, uint256 const& ledgerHash, uint32 ledgerSeq);
|
||||||
void asyncAccept (Ledger::pointer);
|
void asyncAccept (Ledger::pointer);
|
||||||
void missingAcquireComplete (LedgerAcquire::pointer);
|
void missingAcquireComplete (InboundLedger::pointer);
|
||||||
void pubThread ();
|
void pubThread ();
|
||||||
void updatePaths ();
|
void updatePaths ();
|
||||||
|
|
||||||
@@ -197,7 +197,7 @@ private:
|
|||||||
CanonicalTXSet mHeldTransactions;
|
CanonicalTXSet mHeldTransactions;
|
||||||
|
|
||||||
RangeSet mCompleteLedgers;
|
RangeSet mCompleteLedgers;
|
||||||
LedgerAcquire::pointer mMissingLedger;
|
InboundLedger::pointer mMissingLedger;
|
||||||
uint32 mMissingSeq;
|
uint32 mMissingSeq;
|
||||||
|
|
||||||
int mMinValidations; // The minimum validations to publish a ledger
|
int mMinValidations; // The minimum validations to publish a ledger
|
||||||
|
|||||||
@@ -798,7 +798,7 @@ bool NetworkOPs::checkLastClosedLedger (const std::vector<Peer::pointer>& peerLi
|
|||||||
if (mAcquiringLedger)
|
if (mAcquiringLedger)
|
||||||
{
|
{
|
||||||
mAcquiringLedger->abort ();
|
mAcquiringLedger->abort ();
|
||||||
theApp->getMasterLedgerAcquire ().dropLedger (mAcquiringLedger->getHash ());
|
theApp->getInboundLedgers ().dropLedger (mAcquiringLedger->getHash ());
|
||||||
mAcquiringLedger.reset ();
|
mAcquiringLedger.reset ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -819,11 +819,11 @@ bool NetworkOPs::checkLastClosedLedger (const std::vector<Peer::pointer>& peerLi
|
|||||||
WriteLog (lsINFO, NetworkOPs) << "Acquiring consensus ledger " << closedLedger;
|
WriteLog (lsINFO, NetworkOPs) << "Acquiring consensus ledger " << closedLedger;
|
||||||
|
|
||||||
if (!mAcquiringLedger || (mAcquiringLedger->getHash () != closedLedger))
|
if (!mAcquiringLedger || (mAcquiringLedger->getHash () != closedLedger))
|
||||||
mAcquiringLedger = theApp->getMasterLedgerAcquire ().findCreate (closedLedger, 0);
|
mAcquiringLedger = theApp->getInboundLedgers ().findCreate (closedLedger, 0);
|
||||||
|
|
||||||
if (!mAcquiringLedger || mAcquiringLedger->isFailed ())
|
if (!mAcquiringLedger || mAcquiringLedger->isFailed ())
|
||||||
{
|
{
|
||||||
theApp->getMasterLedgerAcquire ().dropLedger (closedLedger);
|
theApp->getInboundLedgers ().dropLedger (closedLedger);
|
||||||
WriteLog (lsERROR, NetworkOPs) << "Network ledger cannot be acquired";
|
WriteLog (lsERROR, NetworkOPs) << "Network ledger cannot be acquired";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -2270,7 +2270,7 @@ void NetworkOPs::gotFetchPack (bool progress, uint32 seq)
|
|||||||
mLastFetchPack = 0;
|
mLastFetchPack = 0;
|
||||||
mFetchSeq = seq; // earliest pack we have data on
|
mFetchSeq = seq; // earliest pack we have data on
|
||||||
theApp->getJobQueue ().addJob (jtLEDGER_DATA, "gotFetchPack",
|
theApp->getJobQueue ().addJob (jtLEDGER_DATA, "gotFetchPack",
|
||||||
boost::bind (&LedgerAcquireMaster::gotFetchPack, &theApp->getMasterLedgerAcquire (), _1));
|
boost::bind (&InboundLedgers::gotFetchPack, &theApp->getInboundLedgers (), _1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkOPs::missingNodeInLedger (uint32 seq)
|
void NetworkOPs::missingNodeInLedger (uint32 seq)
|
||||||
@@ -2279,7 +2279,7 @@ void NetworkOPs::missingNodeInLedger (uint32 seq)
|
|||||||
uint256 hash = theApp->getLedgerMaster ().getHashBySeq (seq);
|
uint256 hash = theApp->getLedgerMaster ().getHashBySeq (seq);
|
||||||
|
|
||||||
if (hash.isNonZero ())
|
if (hash.isNonZero ())
|
||||||
theApp->getMasterLedgerAcquire ().findCreate (hash, seq);
|
theApp->getInboundLedgers ().findCreate (hash, seq);
|
||||||
}
|
}
|
||||||
|
|
||||||
// vim:ts=4
|
// vim:ts=4
|
||||||
|
|||||||
@@ -391,7 +391,7 @@ private:
|
|||||||
std::list<LedgerProposal::pointer> > mStoredProposals;
|
std::list<LedgerProposal::pointer> > mStoredProposals;
|
||||||
|
|
||||||
LedgerMaster* mLedgerMaster;
|
LedgerMaster* mLedgerMaster;
|
||||||
LedgerAcquire::pointer mAcquiringLedger;
|
InboundLedger::pointer mAcquiringLedger;
|
||||||
|
|
||||||
int mCloseTimeOffset;
|
int mCloseTimeOffset;
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// VFALCO TODO Rename the protobuf namespace from ripple to 'wire' or something
|
||||||
|
//
|
||||||
package ripple;
|
package ripple;
|
||||||
|
|
||||||
enum MessageType
|
enum MessageType
|
||||||
|
|||||||
@@ -43,9 +43,9 @@ public:
|
|||||||
{
|
{
|
||||||
return mLedgerMaster;
|
return mLedgerMaster;
|
||||||
}
|
}
|
||||||
LedgerAcquireMaster& getMasterLedgerAcquire ()
|
InboundLedgers& getInboundLedgers ()
|
||||||
{
|
{
|
||||||
return mMasterLedgerAcquire;
|
return m_inboundLedgers;
|
||||||
}
|
}
|
||||||
TransactionMaster& getMasterTransaction ()
|
TransactionMaster& getMasterTransaction ()
|
||||||
{
|
{
|
||||||
@@ -192,7 +192,7 @@ private:
|
|||||||
|
|
||||||
LocalCredentials mLocalCredentials;
|
LocalCredentials mLocalCredentials;
|
||||||
LedgerMaster mLedgerMaster;
|
LedgerMaster mLedgerMaster;
|
||||||
LedgerAcquireMaster mMasterLedgerAcquire;
|
InboundLedgers m_inboundLedgers;
|
||||||
TransactionMaster mMasterTransaction;
|
TransactionMaster mMasterTransaction;
|
||||||
NetworkOPs mNetOps;
|
NetworkOPs mNetOps;
|
||||||
NodeCache mTempNodeCache;
|
NodeCache mTempNodeCache;
|
||||||
@@ -215,10 +215,17 @@ private:
|
|||||||
beast::ScopedPointer <IPeers> mPeers;
|
beast::ScopedPointer <IPeers> mPeers;
|
||||||
// VFALCO End Clean stuff
|
// VFALCO End Clean stuff
|
||||||
|
|
||||||
DatabaseCon* mRpcDB, *mTxnDB, *mLedgerDB, *mWalletDB, *mNetNodeDB, *mPathFindDB, *mHashNodeDB;
|
DatabaseCon* mRpcDB;
|
||||||
|
DatabaseCon* mTxnDB;
|
||||||
|
DatabaseCon* mLedgerDB;
|
||||||
|
DatabaseCon* mWalletDB;
|
||||||
|
DatabaseCon* mNetNodeDB;
|
||||||
|
DatabaseCon* mPathFindDB;
|
||||||
|
DatabaseCon* mHashNodeDB;
|
||||||
|
|
||||||
leveldb::DB* mHashNodeLDB;
|
// VFALCO TODO Wrap this in an interface
|
||||||
leveldb::DB* mEphemeralLDB;
|
leveldb::DB* mHashNodeLDB;
|
||||||
|
leveldb::DB* mEphemeralLDB;
|
||||||
|
|
||||||
PeerDoor* mPeerDoor;
|
PeerDoor* mPeerDoor;
|
||||||
RPCDoor* mRPCDoor;
|
RPCDoor* mRPCDoor;
|
||||||
@@ -227,7 +234,7 @@ private:
|
|||||||
|
|
||||||
boost::asio::deadline_timer mSweepTimer;
|
boost::asio::deadline_timer mSweepTimer;
|
||||||
|
|
||||||
std::map<std::string, Peer::pointer> mPeerMap;
|
std::map <std::string, Peer::pointer> mPeerMap;
|
||||||
boost::recursive_mutex mPeerMapLock;
|
boost::recursive_mutex mPeerMapLock;
|
||||||
|
|
||||||
volatile bool mShutdown;
|
volatile bool mShutdown;
|
||||||
@@ -638,7 +645,7 @@ void Application::sweep ()
|
|||||||
mLedgerMaster.sweep ();
|
mLedgerMaster.sweep ();
|
||||||
mTempNodeCache.sweep ();
|
mTempNodeCache.sweep ();
|
||||||
mValidations->sweep ();
|
mValidations->sweep ();
|
||||||
getMasterLedgerAcquire ().sweep ();
|
getInboundLedgers ().sweep ();
|
||||||
mSLECache.sweep ();
|
mSLECache.sweep ();
|
||||||
AcceptedLedger::sweep (); // VFALCO NOTE AcceptedLedger is/has a singleton?
|
AcceptedLedger::sweep (); // VFALCO NOTE AcceptedLedger is/has a singleton?
|
||||||
SHAMap::sweep (); // VFALCO NOTE SHAMap is/has a singleton?
|
SHAMap::sweep (); // VFALCO NOTE SHAMap is/has a singleton?
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class IValidations;
|
|||||||
|
|
||||||
class HashedObjectStore;
|
class HashedObjectStore;
|
||||||
class JobQueue;
|
class JobQueue;
|
||||||
class LedgerAcquireMaster;
|
class InboundLedgers;
|
||||||
class LedgerMaster;
|
class LedgerMaster;
|
||||||
class LoadManager;
|
class LoadManager;
|
||||||
class NetworkOPs;
|
class NetworkOPs;
|
||||||
@@ -81,7 +81,7 @@ public:
|
|||||||
|
|
||||||
virtual HashedObjectStore& getHashedObjectStore () = 0;
|
virtual HashedObjectStore& getHashedObjectStore () = 0;
|
||||||
virtual JobQueue& getJobQueue () = 0;
|
virtual JobQueue& getJobQueue () = 0;
|
||||||
virtual LedgerAcquireMaster& getMasterLedgerAcquire () = 0;
|
virtual InboundLedgers& getInboundLedgers () = 0;
|
||||||
virtual LedgerMaster& getLedgerMaster () = 0;
|
virtual LedgerMaster& getLedgerMaster () = 0;
|
||||||
virtual LoadManager& getLoadManager () = 0;
|
virtual LoadManager& getLoadManager () = 0;
|
||||||
virtual NetworkOPs& getOPs () = 0;
|
virtual NetworkOPs& getOPs () = 0;
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
SETUP_LOG (LedgerAcquire)
|
SETUP_LOG (InboundLedger)
|
||||||
|
|
||||||
DECLARE_INSTANCE (LedgerAcquire);
|
DECLARE_INSTANCE (InboundLedger);
|
||||||
|
|
||||||
// VFALCO TODO replace macros
|
// VFALCO TODO replace macros
|
||||||
#define LA_DEBUG
|
#define LA_DEBUG
|
||||||
@@ -15,7 +15,7 @@ DECLARE_INSTANCE (LedgerAcquire);
|
|||||||
#define LEDGER_TIMEOUT_AGGRESSIVE 6 // how many timeouts before we get aggressive
|
#define LEDGER_TIMEOUT_AGGRESSIVE 6 // how many timeouts before we get aggressive
|
||||||
#define TRUST_NETWORK
|
#define TRUST_NETWORK
|
||||||
|
|
||||||
LedgerAcquire::LedgerAcquire (uint256 const& hash, uint32 seq)
|
InboundLedger::InboundLedger (uint256 const& hash, uint32 seq)
|
||||||
: PeerSet (hash, LEDGER_ACQUIRE_TIMEOUT)
|
: PeerSet (hash, LEDGER_ACQUIRE_TIMEOUT)
|
||||||
, mHaveBase (false)
|
, mHaveBase (false)
|
||||||
, mHaveState (false)
|
, mHaveState (false)
|
||||||
@@ -28,12 +28,12 @@ LedgerAcquire::LedgerAcquire (uint256 const& hash, uint32 seq)
|
|||||||
, mSeq (seq)
|
, mSeq (seq)
|
||||||
{
|
{
|
||||||
#ifdef LA_DEBUG
|
#ifdef LA_DEBUG
|
||||||
WriteLog (lsTRACE, LedgerAcquire) << "Acquiring ledger " << mHash;
|
WriteLog (lsTRACE, InboundLedger) << "Acquiring ledger " << mHash;
|
||||||
#endif
|
#endif
|
||||||
tryLocal ();
|
tryLocal ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LedgerAcquire::checkLocal ()
|
void InboundLedger::checkLocal ()
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock sl (mLock);
|
boost::recursive_mutex::scoped_lock sl (mLock);
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ void LedgerAcquire::checkLocal ()
|
|||||||
done ();
|
done ();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LedgerAcquire::tryLocal ()
|
bool InboundLedger::tryLocal ()
|
||||||
{
|
{
|
||||||
// return value: true = no more work to do
|
// return value: true = no more work to do
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ bool LedgerAcquire::tryLocal ()
|
|||||||
if (!theApp->getOPs ().getFetchPack (mHash, data))
|
if (!theApp->getOPs ().getFetchPack (mHash, data))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
WriteLog (lsTRACE, LedgerAcquire) << "Ledger base found in fetch pack";
|
WriteLog (lsTRACE, InboundLedger) << "Ledger base found in fetch pack";
|
||||||
mLedger = boost::make_shared<Ledger> (data, true);
|
mLedger = boost::make_shared<Ledger> (data, true);
|
||||||
theApp->getHashedObjectStore ().store (hotLEDGER, mLedger->getLedgerSeq (), data, mHash);
|
theApp->getHashedObjectStore ().store (hotLEDGER, mLedger->getLedgerSeq (), data, mHash);
|
||||||
}
|
}
|
||||||
@@ -72,7 +72,7 @@ bool LedgerAcquire::tryLocal ()
|
|||||||
if (mLedger->getHash () != mHash)
|
if (mLedger->getHash () != mHash)
|
||||||
{
|
{
|
||||||
// We know for a fact the ledger can never be acquired
|
// We know for a fact the ledger can never be acquired
|
||||||
WriteLog (lsWARNING, LedgerAcquire) << mHash << " cannot be a ledger";
|
WriteLog (lsWARNING, InboundLedger) << mHash << " cannot be a ledger";
|
||||||
mFailed = true;
|
mFailed = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,7 @@ bool LedgerAcquire::tryLocal ()
|
|||||||
{
|
{
|
||||||
if (mLedger->getTransHash ().isZero ())
|
if (mLedger->getTransHash ().isZero ())
|
||||||
{
|
{
|
||||||
WriteLog (lsTRACE, LedgerAcquire) << "No TXNs to fetch";
|
WriteLog (lsTRACE, InboundLedger) << "No TXNs to fetch";
|
||||||
mHaveTransactions = true;
|
mHaveTransactions = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -93,12 +93,12 @@ bool LedgerAcquire::tryLocal ()
|
|||||||
|
|
||||||
if (mLedger->peekTransactionMap ()->fetchRoot (mLedger->getTransHash (), &filter))
|
if (mLedger->peekTransactionMap ()->fetchRoot (mLedger->getTransHash (), &filter))
|
||||||
{
|
{
|
||||||
WriteLog (lsTRACE, LedgerAcquire) << "Got root txn map locally";
|
WriteLog (lsTRACE, InboundLedger) << "Got root txn map locally";
|
||||||
std::vector<uint256> h = mLedger->getNeededTransactionHashes (1, &filter);
|
std::vector<uint256> h = mLedger->getNeededTransactionHashes (1, &filter);
|
||||||
|
|
||||||
if (h.empty ())
|
if (h.empty ())
|
||||||
{
|
{
|
||||||
WriteLog (lsTRACE, LedgerAcquire) << "Had full txn map locally";
|
WriteLog (lsTRACE, InboundLedger) << "Had full txn map locally";
|
||||||
mHaveTransactions = true;
|
mHaveTransactions = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -109,7 +109,7 @@ bool LedgerAcquire::tryLocal ()
|
|||||||
{
|
{
|
||||||
if (mLedger->getAccountHash ().isZero ())
|
if (mLedger->getAccountHash ().isZero ())
|
||||||
{
|
{
|
||||||
WriteLog (lsFATAL, LedgerAcquire) << "We are acquiring a ledger with a zero account hash";
|
WriteLog (lsFATAL, InboundLedger) << "We are acquiring a ledger with a zero account hash";
|
||||||
mHaveState = true;
|
mHaveState = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -118,12 +118,12 @@ bool LedgerAcquire::tryLocal ()
|
|||||||
|
|
||||||
if (mLedger->peekAccountStateMap ()->fetchRoot (mLedger->getAccountHash (), &filter))
|
if (mLedger->peekAccountStateMap ()->fetchRoot (mLedger->getAccountHash (), &filter))
|
||||||
{
|
{
|
||||||
WriteLog (lsTRACE, LedgerAcquire) << "Got root AS map locally";
|
WriteLog (lsTRACE, InboundLedger) << "Got root AS map locally";
|
||||||
std::vector<uint256> h = mLedger->getNeededAccountStateHashes (1, &filter);
|
std::vector<uint256> h = mLedger->getNeededAccountStateHashes (1, &filter);
|
||||||
|
|
||||||
if (h.empty ())
|
if (h.empty ())
|
||||||
{
|
{
|
||||||
WriteLog (lsTRACE, LedgerAcquire) << "Had full AS map locally";
|
WriteLog (lsTRACE, InboundLedger) << "Had full AS map locally";
|
||||||
mHaveState = true;
|
mHaveState = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -132,7 +132,7 @@ bool LedgerAcquire::tryLocal ()
|
|||||||
|
|
||||||
if (mHaveTransactions && mHaveState)
|
if (mHaveTransactions && mHaveState)
|
||||||
{
|
{
|
||||||
WriteLog (lsDEBUG, LedgerAcquire) << "Had everything locally";
|
WriteLog (lsDEBUG, InboundLedger) << "Had everything locally";
|
||||||
mComplete = true;
|
mComplete = true;
|
||||||
mLedger->setClosed ();
|
mLedger->setClosed ();
|
||||||
mLedger->setImmutable ();
|
mLedger->setImmutable ();
|
||||||
@@ -141,14 +141,14 @@ bool LedgerAcquire::tryLocal ()
|
|||||||
return mComplete;
|
return mComplete;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LedgerAcquire::onTimer (bool progress)
|
void InboundLedger::onTimer (bool progress)
|
||||||
{
|
{
|
||||||
mRecentTXNodes.clear ();
|
mRecentTXNodes.clear ();
|
||||||
mRecentASNodes.clear ();
|
mRecentASNodes.clear ();
|
||||||
|
|
||||||
if (getTimeouts () > LEDGER_TIMEOUT_COUNT)
|
if (getTimeouts () > LEDGER_TIMEOUT_COUNT)
|
||||||
{
|
{
|
||||||
WriteLog (lsWARNING, LedgerAcquire) << "Too many timeouts( " << getTimeouts () << ") for ledger " << mHash;
|
WriteLog (lsWARNING, InboundLedger) << "Too many timeouts( " << getTimeouts () << ") for ledger " << mHash;
|
||||||
setFailed ();
|
setFailed ();
|
||||||
done ();
|
done ();
|
||||||
return;
|
return;
|
||||||
@@ -159,7 +159,7 @@ void LedgerAcquire::onTimer (bool progress)
|
|||||||
mAggressive = true;
|
mAggressive = true;
|
||||||
mByHash = true;
|
mByHash = true;
|
||||||
int pc = getPeerCount ();
|
int pc = getPeerCount ();
|
||||||
WriteLog (lsDEBUG, LedgerAcquire) << "No progress(" << pc << ") for ledger " << pc << mHash;
|
WriteLog (lsDEBUG, InboundLedger) << "No progress(" << pc << ") for ledger " << pc << mHash;
|
||||||
|
|
||||||
if (pc == 0)
|
if (pc == 0)
|
||||||
addPeers ();
|
addPeers ();
|
||||||
@@ -168,20 +168,20 @@ void LedgerAcquire::onTimer (bool progress)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LedgerAcquire::awaitData ()
|
void InboundLedger::awaitData ()
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock sl (mLock);
|
boost::recursive_mutex::scoped_lock sl (mLock);
|
||||||
++mWaitCount;
|
++mWaitCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LedgerAcquire::noAwaitData ()
|
void InboundLedger::noAwaitData ()
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock sl (mLock);
|
boost::recursive_mutex::scoped_lock sl (mLock);
|
||||||
|
|
||||||
if (mWaitCount > 0 ) --mWaitCount;
|
if (mWaitCount > 0 ) --mWaitCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LedgerAcquire::addPeers ()
|
void InboundLedger::addPeers ()
|
||||||
{
|
{
|
||||||
std::vector<Peer::pointer> peerList = theApp->getPeers ().getPeerVector ();
|
std::vector<Peer::pointer> peerList = theApp->getPeers ().getPeerVector ();
|
||||||
|
|
||||||
@@ -213,21 +213,21 @@ void LedgerAcquire::addPeers ()
|
|||||||
peerHas (peerList[ (i + firstPeer) % vSize]);
|
peerHas (peerList[ (i + firstPeer) % vSize]);
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::weak_ptr<PeerSet> LedgerAcquire::pmDowncast ()
|
boost::weak_ptr<PeerSet> InboundLedger::pmDowncast ()
|
||||||
{
|
{
|
||||||
return boost::dynamic_pointer_cast<PeerSet> (shared_from_this ());
|
return boost::dynamic_pointer_cast<PeerSet> (shared_from_this ());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LADispatch (
|
static void LADispatch (
|
||||||
Job& job,
|
Job& job,
|
||||||
LedgerAcquire::pointer la,
|
InboundLedger::pointer la,
|
||||||
std::vector< FUNCTION_TYPE<void (LedgerAcquire::pointer)> > trig)
|
std::vector< FUNCTION_TYPE<void (InboundLedger::pointer)> > trig)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < trig.size (); ++i)
|
for (unsigned int i = 0; i < trig.size (); ++i)
|
||||||
trig[i] (la);
|
trig[i] (la);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LedgerAcquire::done ()
|
void InboundLedger::done ()
|
||||||
{
|
{
|
||||||
if (mSignaled)
|
if (mSignaled)
|
||||||
return;
|
return;
|
||||||
@@ -236,12 +236,12 @@ void LedgerAcquire::done ()
|
|||||||
touch ();
|
touch ();
|
||||||
|
|
||||||
#ifdef LA_DEBUG
|
#ifdef LA_DEBUG
|
||||||
WriteLog (lsTRACE, LedgerAcquire) << "Done acquiring ledger " << mHash;
|
WriteLog (lsTRACE, InboundLedger) << "Done acquiring ledger " << mHash;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
assert (isComplete () || isFailed ());
|
assert (isComplete () || isFailed ());
|
||||||
|
|
||||||
std::vector< FUNCTION_TYPE<void (LedgerAcquire::pointer)> > triggers;
|
std::vector< FUNCTION_TYPE<void (InboundLedger::pointer)> > triggers;
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock sl (mLock);
|
boost::recursive_mutex::scoped_lock sl (mLock);
|
||||||
triggers.swap (mOnComplete);
|
triggers.swap (mOnComplete);
|
||||||
@@ -258,14 +258,14 @@ void LedgerAcquire::done ()
|
|||||||
theApp->getLedgerMaster ().storeLedger (mLedger);
|
theApp->getLedgerMaster ().storeLedger (mLedger);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
theApp->getMasterLedgerAcquire ().logFailure (mHash);
|
theApp->getInboundLedgers ().logFailure (mHash);
|
||||||
|
|
||||||
if (!triggers.empty ()) // We hold the PeerSet lock, so must dispatch
|
if (!triggers.empty ()) // We hold the PeerSet lock, so must dispatch
|
||||||
theApp->getJobQueue ().addJob (jtLEDGER_DATA, "triggers",
|
theApp->getJobQueue ().addJob (jtLEDGER_DATA, "triggers",
|
||||||
BIND_TYPE (LADispatch, P_1, shared_from_this (), triggers));
|
BIND_TYPE (LADispatch, P_1, shared_from_this (), triggers));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LedgerAcquire::addOnComplete (FUNCTION_TYPE<void (LedgerAcquire::pointer)> trigger)
|
bool InboundLedger::addOnComplete (FUNCTION_TYPE<void (InboundLedger::pointer)> trigger)
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock sl (mLock);
|
boost::recursive_mutex::scoped_lock sl (mLock);
|
||||||
|
|
||||||
@@ -276,13 +276,13 @@ bool LedgerAcquire::addOnComplete (FUNCTION_TYPE<void (LedgerAcquire::pointer)>
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LedgerAcquire::trigger (Peer::ref peer)
|
void InboundLedger::trigger (Peer::ref peer)
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock sl (mLock);
|
boost::recursive_mutex::scoped_lock sl (mLock);
|
||||||
|
|
||||||
if (isDone ())
|
if (isDone ())
|
||||||
{
|
{
|
||||||
WriteLog (lsDEBUG, LedgerAcquire) << "Trigger on ledger: " << mHash <<
|
WriteLog (lsDEBUG, InboundLedger) << "Trigger on ledger: " << mHash <<
|
||||||
(mAborted ? " aborted" : "") << (mComplete ? " completed" : "") << (mFailed ? " failed" : "");
|
(mAborted ? " aborted" : "") << (mComplete ? " completed" : "") << (mFailed ? " failed" : "");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -290,21 +290,21 @@ void LedgerAcquire::trigger (Peer::ref peer)
|
|||||||
if ((mWaitCount > 0) && peer)
|
if ((mWaitCount > 0) && peer)
|
||||||
{
|
{
|
||||||
mRecentPeers.push_back (peer->getPeerId ());
|
mRecentPeers.push_back (peer->getPeerId ());
|
||||||
WriteLog (lsTRACE, LedgerAcquire) << "Deferring peer";
|
WriteLog (lsTRACE, InboundLedger) << "Deferring peer";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShouldLog (lsTRACE, LedgerAcquire))
|
if (ShouldLog (lsTRACE, InboundLedger))
|
||||||
{
|
{
|
||||||
if (peer)
|
if (peer)
|
||||||
WriteLog (lsTRACE, LedgerAcquire) << "Trigger acquiring ledger " << mHash << " from " << peer->getIP ();
|
WriteLog (lsTRACE, InboundLedger) << "Trigger acquiring ledger " << mHash << " from " << peer->getIP ();
|
||||||
else
|
else
|
||||||
WriteLog (lsTRACE, LedgerAcquire) << "Trigger acquiring ledger " << mHash;
|
WriteLog (lsTRACE, InboundLedger) << "Trigger acquiring ledger " << mHash;
|
||||||
|
|
||||||
if (mComplete || mFailed)
|
if (mComplete || mFailed)
|
||||||
WriteLog (lsTRACE, LedgerAcquire) << "complete=" << mComplete << " failed=" << mFailed;
|
WriteLog (lsTRACE, InboundLedger) << "complete=" << mComplete << " failed=" << mFailed;
|
||||||
else
|
else
|
||||||
WriteLog (lsTRACE, LedgerAcquire) << "base=" << mHaveBase << " tx=" << mHaveTransactions << " as=" << mHaveState;
|
WriteLog (lsTRACE, InboundLedger) << "base=" << mHaveBase << " tx=" << mHaveTransactions << " as=" << mHaveState;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mHaveBase)
|
if (!mHaveBase)
|
||||||
@@ -313,7 +313,7 @@ void LedgerAcquire::trigger (Peer::ref peer)
|
|||||||
|
|
||||||
if (mFailed)
|
if (mFailed)
|
||||||
{
|
{
|
||||||
WriteLog (lsWARNING, LedgerAcquire) << " failed local for " << mHash;
|
WriteLog (lsWARNING, InboundLedger) << " failed local for " << mHash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,7 +336,7 @@ void LedgerAcquire::trigger (Peer::ref peer)
|
|||||||
bool typeSet = false;
|
bool typeSet = false;
|
||||||
BOOST_FOREACH (neededHash_t & p, need)
|
BOOST_FOREACH (neededHash_t & p, need)
|
||||||
{
|
{
|
||||||
WriteLog (lsWARNING, LedgerAcquire) << "Want: " << p.second;
|
WriteLog (lsWARNING, InboundLedger) << "Want: " << p.second;
|
||||||
|
|
||||||
if (!typeSet)
|
if (!typeSet)
|
||||||
{
|
{
|
||||||
@@ -366,11 +366,11 @@ void LedgerAcquire::trigger (Peer::ref peer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WriteLog (lsINFO, LedgerAcquire) << "Attempting by hash fetch for ledger " << mHash;
|
WriteLog (lsINFO, InboundLedger) << "Attempting by hash fetch for ledger " << mHash;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WriteLog (lsINFO, LedgerAcquire) << "getNeededHashes says acquire is complete";
|
WriteLog (lsINFO, InboundLedger) << "getNeededHashes says acquire is complete";
|
||||||
mHaveBase = true;
|
mHaveBase = true;
|
||||||
mHaveTransactions = true;
|
mHaveTransactions = true;
|
||||||
mHaveState = true;
|
mHaveState = true;
|
||||||
@@ -382,7 +382,7 @@ void LedgerAcquire::trigger (Peer::ref peer)
|
|||||||
if (!mHaveBase && !mFailed)
|
if (!mHaveBase && !mFailed)
|
||||||
{
|
{
|
||||||
tmGL.set_itype (ripple::liBASE);
|
tmGL.set_itype (ripple::liBASE);
|
||||||
WriteLog (lsTRACE, LedgerAcquire) << "Sending base request to " << (peer ? "selected peer" : "all peers");
|
WriteLog (lsTRACE, InboundLedger) << "Sending base request to " << (peer ? "selected peer" : "all peers");
|
||||||
sendRequest (tmGL, peer);
|
sendRequest (tmGL, peer);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -399,7 +399,7 @@ void LedgerAcquire::trigger (Peer::ref peer)
|
|||||||
// we need the root node
|
// we need the root node
|
||||||
tmGL.set_itype (ripple::liTX_NODE);
|
tmGL.set_itype (ripple::liTX_NODE);
|
||||||
* (tmGL.add_nodeids ()) = SHAMapNode ().getRawString ();
|
* (tmGL.add_nodeids ()) = SHAMapNode ().getRawString ();
|
||||||
WriteLog (lsTRACE, LedgerAcquire) << "Sending TX root request to " << (peer ? "selected peer" : "all peers");
|
WriteLog (lsTRACE, InboundLedger) << "Sending TX root request to " << (peer ? "selected peer" : "all peers");
|
||||||
sendRequest (tmGL, peer);
|
sendRequest (tmGL, peer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -435,7 +435,7 @@ void LedgerAcquire::trigger (Peer::ref peer)
|
|||||||
{
|
{
|
||||||
* (tmGL.add_nodeids ()) = it.getRawString ();
|
* (tmGL.add_nodeids ()) = it.getRawString ();
|
||||||
}
|
}
|
||||||
WriteLog (lsTRACE, LedgerAcquire) << "Sending TX node " << nodeIDs.size ()
|
WriteLog (lsTRACE, InboundLedger) << "Sending TX node " << nodeIDs.size ()
|
||||||
<< " request to " << (peer ? "selected peer" : "all peers");
|
<< " request to " << (peer ? "selected peer" : "all peers");
|
||||||
sendRequest (tmGL, peer);
|
sendRequest (tmGL, peer);
|
||||||
}
|
}
|
||||||
@@ -452,7 +452,7 @@ void LedgerAcquire::trigger (Peer::ref peer)
|
|||||||
// we need the root node
|
// we need the root node
|
||||||
tmGL.set_itype (ripple::liAS_NODE);
|
tmGL.set_itype (ripple::liAS_NODE);
|
||||||
* (tmGL.add_nodeids ()) = SHAMapNode ().getRawString ();
|
* (tmGL.add_nodeids ()) = SHAMapNode ().getRawString ();
|
||||||
WriteLog (lsTRACE, LedgerAcquire) << "Sending AS root request to " << (peer ? "selected peer" : "all peers");
|
WriteLog (lsTRACE, InboundLedger) << "Sending AS root request to " << (peer ? "selected peer" : "all peers");
|
||||||
sendRequest (tmGL, peer);
|
sendRequest (tmGL, peer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -486,9 +486,9 @@ void LedgerAcquire::trigger (Peer::ref peer)
|
|||||||
tmGL.set_itype (ripple::liAS_NODE);
|
tmGL.set_itype (ripple::liAS_NODE);
|
||||||
BOOST_FOREACH (SHAMapNode & it, nodeIDs)
|
BOOST_FOREACH (SHAMapNode & it, nodeIDs)
|
||||||
* (tmGL.add_nodeids ()) = it.getRawString ();
|
* (tmGL.add_nodeids ()) = it.getRawString ();
|
||||||
WriteLog (lsTRACE, LedgerAcquire) << "Sending AS node " << nodeIDs.size ()
|
WriteLog (lsTRACE, InboundLedger) << "Sending AS node " << nodeIDs.size ()
|
||||||
<< " request to " << (peer ? "selected peer" : "all peers");
|
<< " request to " << (peer ? "selected peer" : "all peers");
|
||||||
CondLog (nodeIDs.size () == 1, lsTRACE, LedgerAcquire) << "AS node: " << nodeIDs[0];
|
CondLog (nodeIDs.size () == 1, lsTRACE, InboundLedger) << "AS node: " << nodeIDs[0];
|
||||||
sendRequest (tmGL, peer);
|
sendRequest (tmGL, peer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -499,7 +499,7 @@ void LedgerAcquire::trigger (Peer::ref peer)
|
|||||||
|
|
||||||
if (mComplete || mFailed)
|
if (mComplete || mFailed)
|
||||||
{
|
{
|
||||||
WriteLog (lsDEBUG, LedgerAcquire) << "Done:" << (mComplete ? " complete" : "") << (mFailed ? " failed " : " ")
|
WriteLog (lsDEBUG, InboundLedger) << "Done:" << (mComplete ? " complete" : "") << (mFailed ? " failed " : " ")
|
||||||
<< mLedger->getLedgerSeq ();
|
<< mLedger->getLedgerSeq ();
|
||||||
sl.unlock ();
|
sl.unlock ();
|
||||||
done ();
|
done ();
|
||||||
@@ -558,7 +558,7 @@ int PeerSet::getPeerCount () const
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LedgerAcquire::filterNodes (std::vector<SHAMapNode>& nodeIDs, std::vector<uint256>& nodeHashes,
|
void InboundLedger::filterNodes (std::vector<SHAMapNode>& nodeIDs, std::vector<uint256>& nodeHashes,
|
||||||
std::set<SHAMapNode>& recentNodes, int max, bool aggressive)
|
std::set<SHAMapNode>& recentNodes, int max, bool aggressive)
|
||||||
{
|
{
|
||||||
// ask for new nodes in preference to ones we've already asked for
|
// ask for new nodes in preference to ones we've already asked for
|
||||||
@@ -606,7 +606,7 @@ void LedgerAcquire::filterNodes (std::vector<SHAMapNode>& nodeIDs, std::vector<u
|
|||||||
++insertPoint;
|
++insertPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteLog (lsTRACE, LedgerAcquire) << "filterNodes " << nodeIDs.size () << " to " << insertPoint;
|
WriteLog (lsTRACE, InboundLedger) << "filterNodes " << nodeIDs.size () << " to " << insertPoint;
|
||||||
nodeIDs.resize (insertPoint);
|
nodeIDs.resize (insertPoint);
|
||||||
nodeHashes.resize (insertPoint);
|
nodeHashes.resize (insertPoint);
|
||||||
}
|
}
|
||||||
@@ -621,11 +621,11 @@ void LedgerAcquire::filterNodes (std::vector<SHAMapNode>& nodeIDs, std::vector<u
|
|||||||
recentNodes.insert (n);
|
recentNodes.insert (n);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LedgerAcquire::takeBase (const std::string& data) // data must not have hash prefix
|
bool InboundLedger::takeBase (const std::string& data) // data must not have hash prefix
|
||||||
{
|
{
|
||||||
// Return value: true=normal, false=bad data
|
// Return value: true=normal, false=bad data
|
||||||
#ifdef LA_DEBUG
|
#ifdef LA_DEBUG
|
||||||
WriteLog (lsTRACE, LedgerAcquire) << "got base acquiring ledger " << mHash;
|
WriteLog (lsTRACE, InboundLedger) << "got base acquiring ledger " << mHash;
|
||||||
#endif
|
#endif
|
||||||
boost::recursive_mutex::scoped_lock sl (mLock);
|
boost::recursive_mutex::scoped_lock sl (mLock);
|
||||||
|
|
||||||
@@ -636,8 +636,8 @@ bool LedgerAcquire::takeBase (const std::string& data) // data must not have has
|
|||||||
|
|
||||||
if (mLedger->getHash () != mHash)
|
if (mLedger->getHash () != mHash)
|
||||||
{
|
{
|
||||||
WriteLog (lsWARNING, LedgerAcquire) << "Acquire hash mismatch";
|
WriteLog (lsWARNING, InboundLedger) << "Acquire hash mismatch";
|
||||||
WriteLog (lsWARNING, LedgerAcquire) << mLedger->getHash () << "!=" << mHash;
|
WriteLog (lsWARNING, InboundLedger) << mLedger->getHash () << "!=" << mHash;
|
||||||
mLedger.reset ();
|
mLedger.reset ();
|
||||||
#ifdef TRUST_NETWORK
|
#ifdef TRUST_NETWORK
|
||||||
assert (false);
|
assert (false);
|
||||||
@@ -664,7 +664,7 @@ bool LedgerAcquire::takeBase (const std::string& data) // data must not have has
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LedgerAcquire::takeTxNode (const std::list<SHAMapNode>& nodeIDs,
|
bool InboundLedger::takeTxNode (const std::list<SHAMapNode>& nodeIDs,
|
||||||
const std::list< Blob >& data, SHAMapAddNode& san)
|
const std::list< Blob >& data, SHAMapAddNode& san)
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock sl (mLock);
|
boost::recursive_mutex::scoped_lock sl (mLock);
|
||||||
@@ -712,17 +712,17 @@ bool LedgerAcquire::takeTxNode (const std::list<SHAMapNode>& nodeIDs,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LedgerAcquire::takeAsNode (const std::list<SHAMapNode>& nodeIDs,
|
bool InboundLedger::takeAsNode (const std::list<SHAMapNode>& nodeIDs,
|
||||||
const std::list< Blob >& data, SHAMapAddNode& san)
|
const std::list< Blob >& data, SHAMapAddNode& san)
|
||||||
{
|
{
|
||||||
WriteLog (lsTRACE, LedgerAcquire) << "got ASdata (" << nodeIDs.size () << ") acquiring ledger " << mHash;
|
WriteLog (lsTRACE, InboundLedger) << "got ASdata (" << nodeIDs.size () << ") acquiring ledger " << mHash;
|
||||||
CondLog (nodeIDs.size () == 1, lsTRACE, LedgerAcquire) << "got AS node: " << nodeIDs.front ();
|
CondLog (nodeIDs.size () == 1, lsTRACE, InboundLedger) << "got AS node: " << nodeIDs.front ();
|
||||||
|
|
||||||
boost::recursive_mutex::scoped_lock sl (mLock);
|
boost::recursive_mutex::scoped_lock sl (mLock);
|
||||||
|
|
||||||
if (!mHaveBase)
|
if (!mHaveBase)
|
||||||
{
|
{
|
||||||
WriteLog (lsWARNING, LedgerAcquire) << "Don't have ledger base";
|
WriteLog (lsWARNING, InboundLedger) << "Don't have ledger base";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -740,13 +740,13 @@ bool LedgerAcquire::takeAsNode (const std::list<SHAMapNode>& nodeIDs,
|
|||||||
if (!san.combine (mLedger->peekAccountStateMap ()->addRootNode (mLedger->getAccountHash (),
|
if (!san.combine (mLedger->peekAccountStateMap ()->addRootNode (mLedger->getAccountHash (),
|
||||||
*nodeDatait, snfWIRE, &tFilter)))
|
*nodeDatait, snfWIRE, &tFilter)))
|
||||||
{
|
{
|
||||||
WriteLog (lsWARNING, LedgerAcquire) << "Bad ledger base";
|
WriteLog (lsWARNING, InboundLedger) << "Bad ledger base";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!san.combine (mLedger->peekAccountStateMap ()->addKnownNode (*nodeIDit, *nodeDatait, &tFilter)))
|
else if (!san.combine (mLedger->peekAccountStateMap ()->addKnownNode (*nodeIDit, *nodeDatait, &tFilter)))
|
||||||
{
|
{
|
||||||
WriteLog (lsWARNING, LedgerAcquire) << "Unable to add AS node";
|
WriteLog (lsWARNING, InboundLedger) << "Unable to add AS node";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -769,7 +769,7 @@ bool LedgerAcquire::takeAsNode (const std::list<SHAMapNode>& nodeIDs,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LedgerAcquire::takeAsRootNode (Blob const& data, SHAMapAddNode& san)
|
bool InboundLedger::takeAsRootNode (Blob const& data, SHAMapAddNode& san)
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock sl (mLock);
|
boost::recursive_mutex::scoped_lock sl (mLock);
|
||||||
|
|
||||||
@@ -784,7 +784,7 @@ bool LedgerAcquire::takeAsRootNode (Blob const& data, SHAMapAddNode& san)
|
|||||||
mLedger->peekAccountStateMap ()->addRootNode (mLedger->getAccountHash (), data, snfWIRE, &tFilter));
|
mLedger->peekAccountStateMap ()->addRootNode (mLedger->getAccountHash (), data, snfWIRE, &tFilter));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LedgerAcquire::takeTxRootNode (Blob const& data, SHAMapAddNode& san)
|
bool InboundLedger::takeTxRootNode (Blob const& data, SHAMapAddNode& san)
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock sl (mLock);
|
boost::recursive_mutex::scoped_lock sl (mLock);
|
||||||
|
|
||||||
@@ -799,7 +799,7 @@ bool LedgerAcquire::takeTxRootNode (Blob const& data, SHAMapAddNode& san)
|
|||||||
mLedger->peekTransactionMap ()->addRootNode (mLedger->getTransHash (), data, snfWIRE, &tFilter));
|
mLedger->peekTransactionMap ()->addRootNode (mLedger->getTransHash (), data, snfWIRE, &tFilter));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<LedgerAcquire::neededHash_t> LedgerAcquire::getNeededHashes ()
|
std::vector<InboundLedger::neededHash_t> InboundLedger::getNeededHashes ()
|
||||||
{
|
{
|
||||||
std::vector<neededHash_t> ret;
|
std::vector<neededHash_t> ret;
|
||||||
|
|
||||||
@@ -828,7 +828,7 @@ std::vector<LedgerAcquire::neededHash_t> LedgerAcquire::getNeededHashes ()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value LedgerAcquire::getJson (int)
|
Json::Value InboundLedger::getJson (int)
|
||||||
{
|
{
|
||||||
Json::Value ret (Json::objectValue);
|
Json::Value ret (Json::objectValue);
|
||||||
ret["hash"] = mHash.GetHex ();
|
ret["hash"] = mHash.GetHex ();
|
||||||
@@ -4,24 +4,24 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#ifndef RIPPLE_LEDGERACQUIRE_H
|
#ifndef RIPPLE_INBOUNDLEDGER_H
|
||||||
#define RIPPLE_LEDGERACQUIRE_H
|
#define RIPPLE_INBOUNDLEDGER_H
|
||||||
|
|
||||||
DEFINE_INSTANCE (LedgerAcquire);
|
DEFINE_INSTANCE (InboundLedger);
|
||||||
|
|
||||||
// VFALCO TODO Rename to InboundLedger
|
// VFALCO TODO Rename to InboundLedger
|
||||||
// A ledger we are trying to acquire
|
// A ledger we are trying to acquire
|
||||||
class LedgerAcquire : private IS_INSTANCE (LedgerAcquire)
|
class InboundLedger : private IS_INSTANCE (InboundLedger)
|
||||||
, public PeerSet
|
, public PeerSet
|
||||||
, public boost::enable_shared_from_this <LedgerAcquire>
|
, public boost::enable_shared_from_this <InboundLedger>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef boost::shared_ptr <LedgerAcquire> pointer;
|
typedef boost::shared_ptr <InboundLedger> pointer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LedgerAcquire (uint256 const& hash, uint32 seq);
|
InboundLedger (uint256 const& hash, uint32 seq);
|
||||||
|
|
||||||
virtual ~LedgerAcquire ()
|
virtual ~InboundLedger ()
|
||||||
{
|
{
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// VFALCO TODO Make thise the Listener / Observer pattern
|
// VFALCO TODO Make thise the Listener / Observer pattern
|
||||||
bool addOnComplete (FUNCTION_TYPE<void (LedgerAcquire::pointer)>);
|
bool addOnComplete (FUNCTION_TYPE<void (InboundLedger::pointer)>);
|
||||||
|
|
||||||
bool takeBase (const std::string& data);
|
bool takeBase (const std::string& data);
|
||||||
bool takeTxNode (const std::list<SHAMapNode>& IDs, const std::list<Blob >& data,
|
bool takeTxNode (const std::list<SHAMapNode>& IDs, const std::list<Blob >& data,
|
||||||
@@ -117,7 +117,7 @@ private:
|
|||||||
|
|
||||||
std::vector <uint64> mRecentPeers;
|
std::vector <uint64> mRecentPeers;
|
||||||
|
|
||||||
std::vector <FUNCTION_TYPE <void (LedgerAcquire::pointer)> > mOnComplete;
|
std::vector <FUNCTION_TYPE <void (InboundLedger::pointer)> > mOnComplete;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -4,11 +4,11 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
LedgerAcquire::pointer LedgerAcquireMaster::findCreate (uint256 const& hash, uint32 seq)
|
InboundLedger::pointer InboundLedgers::findCreate (uint256 const& hash, uint32 seq)
|
||||||
{
|
{
|
||||||
assert (hash.isNonZero ());
|
assert (hash.isNonZero ());
|
||||||
boost::mutex::scoped_lock sl (mLock);
|
boost::mutex::scoped_lock sl (mLock);
|
||||||
LedgerAcquire::pointer& ptr = mLedgers[hash];
|
InboundLedger::pointer& ptr = mLedgers[hash];
|
||||||
|
|
||||||
if (ptr)
|
if (ptr)
|
||||||
{
|
{
|
||||||
@@ -16,7 +16,7 @@ LedgerAcquire::pointer LedgerAcquireMaster::findCreate (uint256 const& hash, uin
|
|||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ptr = boost::make_shared<LedgerAcquire> (hash, seq);
|
ptr = boost::make_shared<InboundLedger> (hash, seq);
|
||||||
|
|
||||||
if (!ptr->isDone ())
|
if (!ptr->isDone ())
|
||||||
{
|
{
|
||||||
@@ -29,17 +29,17 @@ LedgerAcquire::pointer LedgerAcquireMaster::findCreate (uint256 const& hash, uin
|
|||||||
ledger->setClosed ();
|
ledger->setClosed ();
|
||||||
ledger->setImmutable ();
|
ledger->setImmutable ();
|
||||||
theApp->getLedgerMaster ().storeLedger (ledger);
|
theApp->getLedgerMaster ().storeLedger (ledger);
|
||||||
WriteLog (lsDEBUG, LedgerAcquire) << "Acquiring ledger we already have: " << hash;
|
WriteLog (lsDEBUG, InboundLedger) << "Acquiring ledger we already have: " << hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
LedgerAcquire::pointer LedgerAcquireMaster::find (uint256 const& hash)
|
InboundLedger::pointer InboundLedgers::find (uint256 const& hash)
|
||||||
{
|
{
|
||||||
assert (hash.isNonZero ());
|
assert (hash.isNonZero ());
|
||||||
boost::mutex::scoped_lock sl (mLock);
|
boost::mutex::scoped_lock sl (mLock);
|
||||||
std::map<uint256, LedgerAcquire::pointer>::iterator it = mLedgers.find (hash);
|
std::map<uint256, InboundLedger::pointer>::iterator it = mLedgers.find (hash);
|
||||||
|
|
||||||
if (it != mLedgers.end ())
|
if (it != mLedgers.end ())
|
||||||
{
|
{
|
||||||
@@ -47,26 +47,26 @@ LedgerAcquire::pointer LedgerAcquireMaster::find (uint256 const& hash)
|
|||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
return LedgerAcquire::pointer ();
|
return InboundLedger::pointer ();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LedgerAcquireMaster::hasLedger (uint256 const& hash)
|
bool InboundLedgers::hasLedger (uint256 const& hash)
|
||||||
{
|
{
|
||||||
assert (hash.isNonZero ());
|
assert (hash.isNonZero ());
|
||||||
boost::mutex::scoped_lock sl (mLock);
|
boost::mutex::scoped_lock sl (mLock);
|
||||||
return mLedgers.find (hash) != mLedgers.end ();
|
return mLedgers.find (hash) != mLedgers.end ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LedgerAcquireMaster::dropLedger (uint256 const& hash)
|
void InboundLedgers::dropLedger (uint256 const& hash)
|
||||||
{
|
{
|
||||||
assert (hash.isNonZero ());
|
assert (hash.isNonZero ());
|
||||||
boost::mutex::scoped_lock sl (mLock);
|
boost::mutex::scoped_lock sl (mLock);
|
||||||
mLedgers.erase (hash);
|
mLedgers.erase (hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LedgerAcquireMaster::awaitLedgerData (uint256 const& ledgerHash)
|
bool InboundLedgers::awaitLedgerData (uint256 const& ledgerHash)
|
||||||
{
|
{
|
||||||
LedgerAcquire::pointer ledger = find (ledgerHash);
|
InboundLedger::pointer ledger = find (ledgerHash);
|
||||||
|
|
||||||
if (!ledger)
|
if (!ledger)
|
||||||
return false;
|
return false;
|
||||||
@@ -75,19 +75,19 @@ bool LedgerAcquireMaster::awaitLedgerData (uint256 const& ledgerHash)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LedgerAcquireMaster::gotLedgerData (Job&, uint256 hash,
|
void InboundLedgers::gotLedgerData (Job&, uint256 hash,
|
||||||
boost::shared_ptr<ripple::TMLedgerData> packet_ptr, boost::weak_ptr<Peer> wPeer)
|
boost::shared_ptr<ripple::TMLedgerData> packet_ptr, boost::weak_ptr<Peer> wPeer)
|
||||||
{
|
{
|
||||||
ripple::TMLedgerData& packet = *packet_ptr;
|
ripple::TMLedgerData& packet = *packet_ptr;
|
||||||
Peer::pointer peer = wPeer.lock ();
|
Peer::pointer peer = wPeer.lock ();
|
||||||
|
|
||||||
WriteLog (lsTRACE, LedgerAcquire) << "Got data (" << packet.nodes ().size () << ") for acquiring ledger: " << hash;
|
WriteLog (lsTRACE, InboundLedger) << "Got data (" << packet.nodes ().size () << ") for acquiring ledger: " << hash;
|
||||||
|
|
||||||
LedgerAcquire::pointer ledger = find (hash);
|
InboundLedger::pointer ledger = find (hash);
|
||||||
|
|
||||||
if (!ledger)
|
if (!ledger)
|
||||||
{
|
{
|
||||||
WriteLog (lsTRACE, LedgerAcquire) << "Got data for ledger we're not acquiring";
|
WriteLog (lsTRACE, InboundLedger) << "Got data for ledger we're not acquiring";
|
||||||
|
|
||||||
if (peer)
|
if (peer)
|
||||||
peer->punishPeer (LT_InvalidRequest);
|
peer->punishPeer (LT_InvalidRequest);
|
||||||
@@ -104,14 +104,14 @@ void LedgerAcquireMaster::gotLedgerData (Job&, uint256 hash,
|
|||||||
{
|
{
|
||||||
if (packet.nodes_size () < 1)
|
if (packet.nodes_size () < 1)
|
||||||
{
|
{
|
||||||
WriteLog (lsWARNING, LedgerAcquire) << "Got empty base data";
|
WriteLog (lsWARNING, InboundLedger) << "Got empty base data";
|
||||||
peer->punishPeer (LT_InvalidRequest);
|
peer->punishPeer (LT_InvalidRequest);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ledger->takeBase (packet.nodes (0).nodedata ()))
|
if (!ledger->takeBase (packet.nodes (0).nodedata ()))
|
||||||
{
|
{
|
||||||
WriteLog (lsWARNING, LedgerAcquire) << "Got invalid base data";
|
WriteLog (lsWARNING, InboundLedger) << "Got invalid base data";
|
||||||
peer->punishPeer (LT_InvalidRequest);
|
peer->punishPeer (LT_InvalidRequest);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -120,12 +120,12 @@ void LedgerAcquireMaster::gotLedgerData (Job&, uint256 hash,
|
|||||||
|
|
||||||
if ((packet.nodes ().size () > 1) && !ledger->takeAsRootNode (strCopy (packet.nodes (1).nodedata ()), san))
|
if ((packet.nodes ().size () > 1) && !ledger->takeAsRootNode (strCopy (packet.nodes (1).nodedata ()), san))
|
||||||
{
|
{
|
||||||
WriteLog (lsWARNING, LedgerAcquire) << "Included ASbase invalid";
|
WriteLog (lsWARNING, InboundLedger) << "Included ASbase invalid";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((packet.nodes ().size () > 2) && !ledger->takeTxRootNode (strCopy (packet.nodes (2).nodedata ()), san))
|
if ((packet.nodes ().size () > 2) && !ledger->takeTxRootNode (strCopy (packet.nodes (2).nodedata ()), san))
|
||||||
{
|
{
|
||||||
WriteLog (lsWARNING, LedgerAcquire) << "Included TXbase invalid";
|
WriteLog (lsWARNING, InboundLedger) << "Included TXbase invalid";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!san.isInvalid ())
|
if (!san.isInvalid ())
|
||||||
@@ -134,7 +134,7 @@ void LedgerAcquireMaster::gotLedgerData (Job&, uint256 hash,
|
|||||||
ledger->trigger (peer);
|
ledger->trigger (peer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
WriteLog (lsDEBUG, LedgerAcquire) << "Peer sends invalid base data";
|
WriteLog (lsDEBUG, InboundLedger) << "Peer sends invalid base data";
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -146,7 +146,7 @@ void LedgerAcquireMaster::gotLedgerData (Job&, uint256 hash,
|
|||||||
|
|
||||||
if (packet.nodes ().size () <= 0)
|
if (packet.nodes ().size () <= 0)
|
||||||
{
|
{
|
||||||
WriteLog (lsINFO, LedgerAcquire) << "Got response with no nodes";
|
WriteLog (lsINFO, InboundLedger) << "Got response with no nodes";
|
||||||
peer->punishPeer (LT_InvalidRequest);
|
peer->punishPeer (LT_InvalidRequest);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -157,7 +157,7 @@ void LedgerAcquireMaster::gotLedgerData (Job&, uint256 hash,
|
|||||||
|
|
||||||
if (!node.has_nodeid () || !node.has_nodedata ())
|
if (!node.has_nodeid () || !node.has_nodedata ())
|
||||||
{
|
{
|
||||||
WriteLog (lsWARNING, LedgerAcquire) << "Got bad node";
|
WriteLog (lsWARNING, InboundLedger) << "Got bad node";
|
||||||
peer->punishPeer (LT_InvalidRequest);
|
peer->punishPeer (LT_InvalidRequest);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -179,23 +179,23 @@ void LedgerAcquireMaster::gotLedgerData (Job&, uint256 hash,
|
|||||||
ledger->trigger (peer);
|
ledger->trigger (peer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
WriteLog (lsDEBUG, LedgerAcquire) << "Peer sends invalid node data";
|
WriteLog (lsDEBUG, InboundLedger) << "Peer sends invalid node data";
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteLog (lsWARNING, LedgerAcquire) << "Not sure what ledger data we got";
|
WriteLog (lsWARNING, InboundLedger) << "Not sure what ledger data we got";
|
||||||
peer->punishPeer (LT_InvalidRequest);
|
peer->punishPeer (LT_InvalidRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LedgerAcquireMaster::sweep ()
|
void InboundLedgers::sweep ()
|
||||||
{
|
{
|
||||||
mRecentFailures.sweep ();
|
mRecentFailures.sweep ();
|
||||||
|
|
||||||
int now = UptimeTimer::getInstance ().getElapsedSeconds ();
|
int now = UptimeTimer::getInstance ().getElapsedSeconds ();
|
||||||
boost::mutex::scoped_lock sl (mLock);
|
boost::mutex::scoped_lock sl (mLock);
|
||||||
|
|
||||||
std::map<uint256, LedgerAcquire::pointer>::iterator it = mLedgers.begin ();
|
std::map<uint256, InboundLedger::pointer>::iterator it = mLedgers.begin ();
|
||||||
|
|
||||||
while (it != mLedgers.end ())
|
while (it != mLedgers.end ())
|
||||||
{
|
{
|
||||||
@@ -211,12 +211,12 @@ void LedgerAcquireMaster::sweep ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int LedgerAcquireMaster::getFetchCount (int& timeoutCount)
|
int InboundLedgers::getFetchCount (int& timeoutCount)
|
||||||
{
|
{
|
||||||
timeoutCount = 0;
|
timeoutCount = 0;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
{
|
{
|
||||||
typedef std::pair<uint256, LedgerAcquire::pointer> u256_acq_pair;
|
typedef std::pair<uint256, InboundLedger::pointer> u256_acq_pair;
|
||||||
boost::mutex::scoped_lock sl (mLock);
|
boost::mutex::scoped_lock sl (mLock);
|
||||||
BOOST_FOREACH (const u256_acq_pair & it, mLedgers)
|
BOOST_FOREACH (const u256_acq_pair & it, mLedgers)
|
||||||
{
|
{
|
||||||
@@ -230,19 +230,19 @@ int LedgerAcquireMaster::getFetchCount (int& timeoutCount)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LedgerAcquireMaster::gotFetchPack (Job&)
|
void InboundLedgers::gotFetchPack (Job&)
|
||||||
{
|
{
|
||||||
std::vector<LedgerAcquire::pointer> acquires;
|
std::vector<InboundLedger::pointer> acquires;
|
||||||
{
|
{
|
||||||
boost::mutex::scoped_lock sl (mLock);
|
boost::mutex::scoped_lock sl (mLock);
|
||||||
|
|
||||||
acquires.reserve (mLedgers.size ());
|
acquires.reserve (mLedgers.size ());
|
||||||
typedef std::pair<uint256, LedgerAcquire::pointer> u256_acq_pair;
|
typedef std::pair<uint256, InboundLedger::pointer> u256_acq_pair;
|
||||||
BOOST_FOREACH (const u256_acq_pair & it, mLedgers)
|
BOOST_FOREACH (const u256_acq_pair & it, mLedgers)
|
||||||
acquires.push_back (it.second);
|
acquires.push_back (it.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH (const LedgerAcquire::pointer & acquire, acquires)
|
BOOST_FOREACH (const InboundLedger::pointer & acquire, acquires)
|
||||||
{
|
{
|
||||||
acquire->checkLocal ();
|
acquire->checkLocal ();
|
||||||
}
|
}
|
||||||
@@ -4,37 +4,53 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#ifndef RIPPLE_LEDGERACQUIREMASTER_H
|
#ifndef RIPPLE_INBOUNDLEDGERS_H
|
||||||
#define RIPPLE_LEDGERACQUIREMASTER_H
|
#define RIPPLE_INBOUNDLEDGERS_H
|
||||||
|
|
||||||
/** Manages the lifetime of inbound ledgers.
|
/** Manages the lifetime of inbound ledgers.
|
||||||
|
|
||||||
|
@see InboundLedger
|
||||||
*/
|
*/
|
||||||
// VFALCO TODO Rename to InboundLedgers
|
// VFALCO TODO Rename to InboundLedgers
|
||||||
// VFALCO TODO Create abstract interface
|
// VFALCO TODO Create abstract interface
|
||||||
class LedgerAcquireMaster
|
class InboundLedgers
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// How long before we try again to acquire the same ledger
|
// How long before we try again to acquire the same ledger
|
||||||
static const int kReacquireIntervalSeconds = 600;
|
static const int kReacquireIntervalSeconds = 600;
|
||||||
|
|
||||||
LedgerAcquireMaster ()
|
InboundLedgers ()
|
||||||
: mRecentFailures ("LedgerAcquireRecentFailures", 0, kReacquireIntervalSeconds)
|
: mRecentFailures ("LedgerAcquireRecentFailures", 0, kReacquireIntervalSeconds)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
LedgerAcquire::pointer findCreate (uint256 const& hash, uint32 seq);
|
// VFALCO TODO Should this be called findOrAdd ?
|
||||||
LedgerAcquire::pointer find (uint256 const& hash);
|
//
|
||||||
bool hasLedger (uint256 const& ledgerHash);
|
InboundLedger::pointer findCreate (uint256 const& hash, uint32 seq);
|
||||||
void dropLedger (uint256 const& ledgerHash);
|
|
||||||
|
|
||||||
bool awaitLedgerData (uint256 const& ledgerHash);
|
InboundLedger::pointer find (uint256 const& hash);
|
||||||
void gotLedgerData (Job&, uint256 hash, boost::shared_ptr<ripple::TMLedgerData> packet, boost::weak_ptr<Peer> peer);
|
|
||||||
|
bool hasLedger (LedgerHash const& ledgerHash);
|
||||||
|
|
||||||
|
void dropLedger (LedgerHash const& ledgerHash);
|
||||||
|
|
||||||
|
bool awaitLedgerData (LedgerHash const& ledgerHash);
|
||||||
|
|
||||||
|
// VFALCO TODO Why is hash passed by value?
|
||||||
|
// VFALCO TODO Remove the dependency on the Peer object.
|
||||||
|
//
|
||||||
|
void gotLedgerData (Job&,
|
||||||
|
LedgerHash hash,
|
||||||
|
boost::shared_ptr <ripple::TMLedgerData> packet,
|
||||||
|
boost::weak_ptr<Peer> peer);
|
||||||
|
|
||||||
int getFetchCount (int& timeoutCount);
|
int getFetchCount (int& timeoutCount);
|
||||||
|
|
||||||
void logFailure (uint256 const& h)
|
void logFailure (uint256 const& h)
|
||||||
{
|
{
|
||||||
mRecentFailures.add (h);
|
mRecentFailures.add (h);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isFailure (uint256 const& h)
|
bool isFailure (uint256 const& h)
|
||||||
{
|
{
|
||||||
return mRecentFailures.isPresent (h, false);
|
return mRecentFailures.isPresent (h, false);
|
||||||
@@ -45,10 +61,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
boost::mutex mLock;
|
boost::mutex mLock;
|
||||||
std::map <uint256, LedgerAcquire::pointer> mLedgers;
|
std::map <uint256, InboundLedger::pointer> mLedgers;
|
||||||
KeyCache <uint256, UptimeTimerAdapter> mRecentFailures;
|
KeyCache <uint256, UptimeTimerAdapter> mRecentFailures;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// vim:ts=4
|
|
||||||
@@ -208,9 +208,9 @@ void LedgerConsensus::handleLCL (uint256 const& lclHash)
|
|||||||
WriteLog (lsWARNING, LedgerConsensus) << "Need consensus ledger " << mPrevLedgerHash;
|
WriteLog (lsWARNING, LedgerConsensus) << "Need consensus ledger " << mPrevLedgerHash;
|
||||||
|
|
||||||
if (mAcquiringLedger)
|
if (mAcquiringLedger)
|
||||||
theApp->getMasterLedgerAcquire ().dropLedger (mAcquiringLedger->getHash ());
|
theApp->getInboundLedgers ().dropLedger (mAcquiringLedger->getHash ());
|
||||||
|
|
||||||
mAcquiringLedger = theApp->getMasterLedgerAcquire ().findCreate (mPrevLedgerHash, 0);
|
mAcquiringLedger = theApp->getInboundLedgers ().findCreate (mPrevLedgerHash, 0);
|
||||||
mHaveCorrectLCL = false;
|
mHaveCorrectLCL = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ private:
|
|||||||
uint32 mCloseTime; // The wall time this ledger closed
|
uint32 mCloseTime; // The wall time this ledger closed
|
||||||
uint256 mPrevLedgerHash, mNewLedgerHash;
|
uint256 mPrevLedgerHash, mNewLedgerHash;
|
||||||
Ledger::pointer mPreviousLedger;
|
Ledger::pointer mPreviousLedger;
|
||||||
LedgerAcquire::pointer mAcquiringLedger;
|
InboundLedger::pointer mAcquiringLedger;
|
||||||
LedgerProposal::pointer mOurPosition;
|
LedgerProposal::pointer mOurPosition;
|
||||||
RippleAddress mValPublic, mValPrivate;
|
RippleAddress mValPublic, mValPrivate;
|
||||||
bool mProposing, mValidating, mHaveCorrectLCL, mConsensusFail;
|
bool mProposing, mValidating, mHaveCorrectLCL, mConsensusFail;
|
||||||
|
|||||||
@@ -2070,9 +2070,9 @@ void PeerImp::recvLedger (const boost::shared_ptr<ripple::TMLedgerData>& packet_
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theApp->getMasterLedgerAcquire ().awaitLedgerData (hash))
|
if (theApp->getInboundLedgers ().awaitLedgerData (hash))
|
||||||
theApp->getJobQueue ().addJob (jtLEDGER_DATA, "gotLedgerData",
|
theApp->getJobQueue ().addJob (jtLEDGER_DATA, "gotLedgerData",
|
||||||
BIND_TYPE (&LedgerAcquireMaster::gotLedgerData, &theApp->getMasterLedgerAcquire (),
|
BIND_TYPE (&InboundLedgers::gotLedgerData, &theApp->getInboundLedgers (),
|
||||||
P_1, hash, packet_ptr, boost::weak_ptr<Peer> (shared_from_this ())));
|
P_1, hash, packet_ptr, boost::weak_ptr<Peer> (shared_from_this ())));
|
||||||
else
|
else
|
||||||
punishPeer (LT_UnwantedData);
|
punishPeer (LT_UnwantedData);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
class LedgerAcquire;
|
class InboundLedger;
|
||||||
|
|
||||||
PeerSet::PeerSet (uint256 const& hash, int interval)
|
PeerSet::PeerSet (uint256 const& hash, int interval)
|
||||||
: mHash (hash)
|
: mHash (hash)
|
||||||
@@ -52,7 +52,7 @@ void PeerSet::invokeOnTimer ()
|
|||||||
if (!mProgress)
|
if (!mProgress)
|
||||||
{
|
{
|
||||||
++mTimeouts;
|
++mTimeouts;
|
||||||
WriteLog (lsWARNING, LedgerAcquire) << "Timeout(" << mTimeouts << ") pc=" << mPeers.size () << " acquiring " << mHash;
|
WriteLog (lsWARNING, InboundLedger) << "Timeout(" << mTimeouts << ") pc=" << mPeers.size () << " acquiring " << mHash;
|
||||||
onTimer (false);
|
onTimer (false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -78,7 +78,7 @@ void PeerSet::TimerEntry (boost::weak_ptr<PeerSet> wptr, const boost::system::er
|
|||||||
|
|
||||||
if (jc > 4)
|
if (jc > 4)
|
||||||
{
|
{
|
||||||
WriteLog (lsDEBUG, LedgerAcquire) << "Deferring PeerSet timer due to load";
|
WriteLog (lsDEBUG, InboundLedger) << "Deferring PeerSet timer due to load";
|
||||||
ptr->setTimer ();
|
ptr->setTimer ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ static void TACompletionHandler (uint256 hash, SHAMap::pointer map)
|
|||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock sl (theApp->getMasterLock ());
|
boost::recursive_mutex::scoped_lock sl (theApp->getMasterLock ());
|
||||||
theApp->getOPs ().mapComplete (hash, map);
|
theApp->getOPs ().mapComplete (hash, map);
|
||||||
theApp->getMasterLedgerAcquire ().dropLedger (hash);
|
theApp->getInboundLedgers ().dropLedger (hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransactionAcquire::done ()
|
void TransactionAcquire::done ()
|
||||||
|
|||||||
Reference in New Issue
Block a user