diff --git a/Builds/VisualStudio2012/RippleD.vcxproj b/Builds/VisualStudio2012/RippleD.vcxproj
index 8bd7bbbe7..af5813bb7 100644
--- a/Builds/VisualStudio2012/RippleD.vcxproj
+++ b/Builds/VisualStudio2012/RippleD.vcxproj
@@ -169,6 +169,7 @@
+
Level4
@@ -1517,6 +1518,7 @@
+
diff --git a/Builds/VisualStudio2012/RippleD.vcxproj.filters b/Builds/VisualStudio2012/RippleD.vcxproj.filters
index 132e98624..dff7c556c 100644
--- a/Builds/VisualStudio2012/RippleD.vcxproj.filters
+++ b/Builds/VisualStudio2012/RippleD.vcxproj.filters
@@ -139,6 +139,12 @@
{82d79c26-4932-4a48-b134-09969f45d75a}
+
+ {ce56fa36-0012-44ab-a6dd-da0391f32ba3}
+
+
+ {f7a586fa-b21a-4c7b-b87e-5ac62f2758e4}
+
@@ -888,6 +894,9 @@
1. Modules\ripple_leveldb
+
+ 1. Modules\ripple_core
+
@@ -1704,6 +1713,9 @@
1. Modules\ripple_leveldb
+
+ 1. Modules\ripple_core
+
diff --git a/SConstruct b/SConstruct
index 389813e57..b040c4c3c 100644
--- a/SConstruct
+++ b/SConstruct
@@ -104,6 +104,7 @@ COMPILED_FILES = [
'Subtrees/beast/modules/beast_core/beast_core.cpp',
'Subtrees/beast/modules/beast_basics/beast_basics.cpp',
'modules/ripple_basics/ripple_basics.cpp',
+ 'modules/ripple_core/ripple_core.cpp',
'modules/ripple_data/ripple_data.cpp',
'modules/ripple_json/ripple_json.cpp',
'modules/ripple_leveldb/ripple_leveldb.cpp',
diff --git a/modules/ripple_core/ripple_core.cpp b/modules/ripple_core/ripple_core.cpp
new file mode 100644
index 000000000..ff9069834
--- /dev/null
+++ b/modules/ripple_core/ripple_core.cpp
@@ -0,0 +1,16 @@
+//------------------------------------------------------------------------------
+/*
+ Copyright (c) 2011-2013, OpenCoin, Inc.
+*/
+//==============================================================================
+
+/** Add this to get the @ref ripple_core module.
+
+ @file ripple_core.cpp
+ @ingroup ripple_core
+*/
+
+#include "ripple_core.h"
+
+//#include "src/cpp/ripple/ripple_Job.h"
+//#include "src/cpp/ripple/ripple_JobQueue.h"
diff --git a/modules/ripple_core/ripple_core.h b/modules/ripple_core/ripple_core.h
new file mode 100644
index 000000000..71dbf40c0
--- /dev/null
+++ b/modules/ripple_core/ripple_core.h
@@ -0,0 +1,24 @@
+//------------------------------------------------------------------------------
+/*
+ Copyright (c) 2011-2013, OpenCoin, Inc.
+*/
+//==============================================================================
+
+/** Include this to get the @ref ripple_core module.
+
+ @file ripple_core.h
+ @ingroup ripple_core
+*/
+
+/** Core classes.
+
+ These objects form the execution framework in which the Ripple
+ protocol is implemented.
+
+ @defgroup ripple_core
+*/
+
+#ifndef RIPPLE_CORE_RIPPLEHEADER
+#define RIPPLE_CORE_RIPPLEHEADER
+
+#endif
diff --git a/src/cpp/ripple/ripple_Config.h b/src/cpp/ripple/ripple_Config.h
index b8e3f61d4..848769509 100644
--- a/src/cpp/ripple/ripple_Config.h
+++ b/src/cpp/ripple/ripple_Config.h
@@ -87,8 +87,17 @@ public:
std::vector IPS; // Peer IPs from rippled.cfg.
std::vector SNTP_SERVERS; // SNTP servers from rippled.cfg.
- enum StartUpType { FRESH, NORMAL, LOAD, NETWORK };
+ enum StartUpType
+ {
+ FRESH,
+ NORMAL,
+ LOAD,
+ NETWORK
+ };
StartUpType START_UP;
+
+
+
std::string START_LEDGER;
// Database
@@ -101,6 +110,16 @@ public:
int LEDGER_PROPOSAL_DELAY_SECONDS;
int LEDGER_AVALANCHE_SECONDS;
bool LEDGER_CREATOR; // Should be false unless we are starting a new ledger.
+
+ /** Operate in stand-alone mode.
+
+ In stand alone mode:
+
+ - Peer connections are not attempted or accepted
+ - The ledger is not advanced automatically.
+ - If no ledger is loaded, the default ledger with the root
+ account is created.
+ */
bool RUN_STANDALONE;
// Note: The following parameters do not relate to the UNL or trust at all
diff --git a/src/cpp/ripple/ripple_JobQueue.cpp b/src/cpp/ripple/ripple_JobQueue.cpp
index 643ab1add..4084fdaa4 100644
--- a/src/cpp/ripple/ripple_JobQueue.cpp
+++ b/src/cpp/ripple/ripple_JobQueue.cpp
@@ -7,24 +7,27 @@
SETUP_LOG (JobQueue)
JobQueue::JobQueue (boost::asio::io_service& svc)
- : mLastJob (0), mThreadCount (0), mShuttingDown (false), mIOThreadCount (0), mMaxIOThreadCount (1), mIOService (svc)
+ : mLastJob (0)
+ , mThreadCount (0)
+ , mShuttingDown (false)
+ , mIOService (svc)
{
- mJobLoads[jtPUBOLDLEDGER].setTargetLatency (10000, 15000);
- mJobLoads[jtVALIDATION_ut].setTargetLatency (2000, 5000);
- mJobLoads[jtPROOFWORK].setTargetLatency (2000, 5000);
- mJobLoads[jtTRANSACTION].setTargetLatency (250, 1000);
- mJobLoads[jtPROPOSAL_ut].setTargetLatency (500, 1250);
- mJobLoads[jtPUBLEDGER].setTargetLatency (3000, 4500);
- mJobLoads[jtWAL].setTargetLatency (1000, 2500);
- mJobLoads[jtVALIDATION_t].setTargetLatency (500, 1500);
- mJobLoads[jtWRITE].setTargetLatency (750, 1500);
- mJobLoads[jtTRANSACTION_l].setTargetLatency (100, 500);
- mJobLoads[jtPROPOSAL_t].setTargetLatency (100, 500);
+ mJobLoads [ jtPUBOLDLEDGER ].setTargetLatency (10000, 15000);
+ mJobLoads [ jtVALIDATION_ut ].setTargetLatency (2000, 5000);
+ mJobLoads [ jtPROOFWORK ].setTargetLatency (2000, 5000);
+ mJobLoads [ jtTRANSACTION ].setTargetLatency (250, 1000);
+ mJobLoads [ jtPROPOSAL_ut ].setTargetLatency (500, 1250);
+ mJobLoads [ jtPUBLEDGER ].setTargetLatency (3000, 4500);
+ mJobLoads [ jtWAL ].setTargetLatency (1000, 2500);
+ mJobLoads [ jtVALIDATION_t ].setTargetLatency (500, 1500);
+ mJobLoads [ jtWRITE ].setTargetLatency (750, 1500);
+ mJobLoads [ jtTRANSACTION_l ].setTargetLatency (100, 500);
+ mJobLoads [ jtPROPOSAL_t ].setTargetLatency (100, 500);
- mJobLoads[jtCLIENT].setTargetLatency (2000, 5000);
- mJobLoads[jtPEER].setTargetLatency (200, 1250);
- mJobLoads[jtDISK].setTargetLatency (500, 1000);
- mJobLoads[jtACCEPTLEDGER].setTargetLatency (1000, 2500);
+ mJobLoads [ jtCLIENT ].setTargetLatency (2000, 5000);
+ mJobLoads [ jtPEER ].setTargetLatency (200, 1250);
+ mJobLoads [ jtDISK ].setTargetLatency (500, 1000);
+ mJobLoads [ jtACCEPTLEDGER ].setTargetLatency (1000, 2500);
}
void JobQueue::addJob (JobType type, const std::string& name, const FUNCTION_TYPE& jobFunc)
@@ -177,13 +180,18 @@ void JobQueue::shutdown ()
void JobQueue::setThreadCount (int c)
{
if (theConfig.RUN_STANDALONE)
+ {
c = 1;
+ }
else if (c == 0)
{
c = boost::thread::hardware_concurrency ();
+ // VFALCO NOTE According to boost, hardware_concurrency cannot return
+ // negative numbers/
+ //
if (c < 0)
- c = 2;
+ c = 2; // VFALCO NOTE Why 2?
if (c > 4) // I/O will bottleneck
c = 4;
@@ -192,12 +200,15 @@ void JobQueue::setThreadCount (int c)
WriteLog (lsINFO, JobQueue) << "Auto-tuning to " << c << " validation/transaction/proposal threads";
}
+ // VFALCO TODO Split the function up. The lower part actually does the "do",
+ // The part above this comment figures out the value for numThreads
+ //
boost::mutex::scoped_lock sl (mJobLock);
- mMaxIOThreadCount = 1 + (c / 3);
-
while (mJobCounts[jtDEATH].first != 0)
+ {
mJobCond.wait (sl);
+ }
while (mThreadCount < c)
{
@@ -208,7 +219,9 @@ void JobQueue::setThreadCount (int c)
while (mThreadCount > c)
{
if (mJobCounts[jtDEATH].first != 0)
+ {
mJobCond.wait (sl);
+ }
else
{
mJobSet.insert (Job (jtDEATH, 0));
@@ -219,27 +232,6 @@ void JobQueue::setThreadCount (int c)
mJobCond.notify_one (); // in case we sucked up someone else's signal
}
-void JobQueue::IOThread (boost::mutex::scoped_lock& sl)
-{
- // call with a lock
- ++mIOThreadCount;
- sl.unlock ();
- setCallingThreadName ("IO+");
-
- try
- {
- mIOService.poll ();
- }
- catch (...)
- {
- WriteLog (lsWARNING, JobQueue) << "Exception in IOThread";
- }
-
- setCallingThreadName ("waiting");
- sl.lock ();
- --mIOThreadCount;
-}
-
// do jobs until asked to stop
void JobQueue::threadEntry ()
{
@@ -249,19 +241,9 @@ void JobQueue::threadEntry ()
{
setCallingThreadName ("waiting");
- // bool didIO = false;
while (mJobSet.empty () && !mShuttingDown)
{
- // if ((mIOThreadCount < mMaxIOThreadCount) && !didIO && !theApp->isShutdown())
- // {
- // IOThread(sl);
- // didIO = true;
- // }
- // else
- // {
mJobCond.wait (sl);
- // didIO = false;
- // }
}
if (mJobSet.empty ())
diff --git a/src/cpp/ripple/ripple_JobQueue.h b/src/cpp/ripple/ripple_JobQueue.h
index 616ca987e..ce77d4fb5 100644
--- a/src/cpp/ripple/ripple_JobQueue.h
+++ b/src/cpp/ripple/ripple_JobQueue.h
@@ -43,7 +43,6 @@ public:
private:
void threadEntry ();
- void IOThread (boost::mutex::scoped_lock&);
boost::mutex mJobLock;
boost::condition_variable mJobCond;
@@ -54,8 +53,6 @@ private:
int mThreadCount;
bool mShuttingDown;
- int mIOThreadCount;
- int mMaxIOThreadCount;
boost::asio::io_service& mIOService;
std::map > mJobCounts;