mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-21 03:26:01 +00:00
Remove unused functions and clean up some comments
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#ifndef RIPPLE_INSTANCECOUNTER_H
|
#ifndef RIPPLE_INSTANCECOUNTER_H
|
||||||
#define RIPPLE_INSTANCECOUNTER_H
|
#define RIPPLE_INSTANCECOUNTER_H
|
||||||
|
|
||||||
// VFALCO TODO Clean up this junk, remove the macros, replace
|
// VFALCO TODO Clean this up, remove the macros, replace
|
||||||
// with a robust leak checker when we have atomics.
|
// with a robust leak checker when we have atomics.
|
||||||
//
|
//
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ protected:
|
|||||||
public:
|
public:
|
||||||
typedef std::pair<std::string, int> InstanceCount;
|
typedef std::pair<std::string, int> InstanceCount;
|
||||||
|
|
||||||
InstanceType(const char *n) : mInstances(0), mName(n)
|
explicit InstanceType (const char *n) : mInstances(0), mName(n)
|
||||||
{
|
{
|
||||||
mNextInstance = sHeadInstance;
|
mNextInstance = sHeadInstance;
|
||||||
sHeadInstance = this;
|
sHeadInstance = this;
|
||||||
@@ -65,7 +65,7 @@ public:
|
|||||||
{
|
{
|
||||||
if (sMultiThreaded)
|
if (sMultiThreaded)
|
||||||
{
|
{
|
||||||
// VFALCO NOTE Junk that will go away with atomics
|
// VFALCO NOTE This will go away with atomics
|
||||||
mLock.lock();
|
mLock.lock();
|
||||||
++mInstances;
|
++mInstances;
|
||||||
mLock.unlock();
|
mLock.unlock();
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ bool RandomNumbers::platformAddEntropy ()
|
|||||||
|
|
||||||
void RandomNumbers::platformAddPerformanceMonitorEntropy ()
|
void RandomNumbers::platformAddPerformanceMonitorEntropy ()
|
||||||
{
|
{
|
||||||
// VFALCO This is how we simulate local functions
|
// VFALCO TODO Remove all this fancy stuff
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
int64 operator() () const
|
int64 operator() () const
|
||||||
|
|||||||
@@ -19,7 +19,10 @@
|
|||||||
#ifndef RIPPLE_SUSTAIN_H
|
#ifndef RIPPLE_SUSTAIN_H
|
||||||
#define RIPPLE_SUSTAIN_H
|
#define RIPPLE_SUSTAIN_H
|
||||||
|
|
||||||
// VFALCO TODO figure out what the heck this is??
|
// "Sustain" is a system for a buddy process that monitors the main process
|
||||||
|
// and relaunches it on a fault.
|
||||||
|
//
|
||||||
|
// VFALCO TODO Rename this and put it in a class.
|
||||||
extern bool HaveSustain();
|
extern bool HaveSustain();
|
||||||
extern std::string StopSustain();
|
extern std::string StopSustain();
|
||||||
extern std::string DoSustain();
|
extern std::string DoSustain();
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ std::map <int, LedgerEntryFormat*> LedgerEntryFormat::byType;
|
|||||||
|
|
||||||
std::map <std::string, LedgerEntryFormat*> LedgerEntryFormat::byName;
|
std::map <std::string, LedgerEntryFormat*> LedgerEntryFormat::byName;
|
||||||
|
|
||||||
// VFALCO TODO surely we can think of a better way than macros?
|
|
||||||
|
|
||||||
#define LEF_BASE \
|
#define LEF_BASE \
|
||||||
<< SOElement(sfLedgerIndex, SOE_OPTIONAL) \
|
<< SOElement(sfLedgerIndex, SOE_OPTIONAL) \
|
||||||
<< SOElement(sfLedgerEntryType, SOE_REQUIRED) \
|
<< SOElement(sfLedgerEntryType, SOE_REQUIRED) \
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ static const uint160 u160_zero(0), u160_one(1);
|
|||||||
static inline const uint160& get_u160_zero() { return u160_zero; }
|
static inline const uint160& get_u160_zero() { return u160_zero; }
|
||||||
static inline const uint160& get_u160_one() { return u160_one; }
|
static inline const uint160& get_u160_one() { return u160_one; }
|
||||||
|
|
||||||
// VFALCO TODO replace these with language constructs, gah!
|
// VFALCO TODO replace these with language constructs
|
||||||
#define CURRENCY_XRP get_u160_zero()
|
#define CURRENCY_XRP get_u160_zero()
|
||||||
#define CURRENCY_ONE get_u160_one() // Used as a place holder.
|
#define CURRENCY_ONE get_u160_one() // Used as a place holder.
|
||||||
#define CURRENCY_BAD uint160(0x5852500000000000) // Do not allow XRP as an IOU currency.
|
#define CURRENCY_BAD uint160(0x5852500000000000) // Do not allow XRP as an IOU currency.
|
||||||
|
|||||||
@@ -117,20 +117,6 @@ bool SqliteDatabase::executeSQL(const char* sql, bool fail_ok)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// tells you how many rows were changed by an update or insert
|
|
||||||
int SqliteDatabase::getNumRowsAffected()
|
|
||||||
{
|
|
||||||
// TODO: SqliteDatabase::getNumRowsAffected()
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// VFALCO TODO This must be fixed!!! return value needs to be int64
|
|
||||||
//
|
|
||||||
int SqliteDatabase::getLastInsertID()
|
|
||||||
{
|
|
||||||
return(sqlite3_last_insert_rowid(mConnection));
|
|
||||||
}
|
|
||||||
|
|
||||||
// returns false if there are no results
|
// returns false if there are no results
|
||||||
bool SqliteDatabase::startIterRows(bool finalize)
|
bool SqliteDatabase::startIterRows(bool finalize)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ public:
|
|||||||
|
|
||||||
// tells you how many rows were changed by an update or insert
|
// tells you how many rows were changed by an update or insert
|
||||||
int getNumRowsAffected();
|
int getNumRowsAffected();
|
||||||
int getLastInsertID();
|
|
||||||
|
|
||||||
// returns false if there are no results
|
// returns false if there are no results
|
||||||
bool startIterRows(bool finalize);
|
bool startIterRows(bool finalize);
|
||||||
|
|||||||
@@ -43,10 +43,6 @@ public:
|
|||||||
return executeSQL(strSql.c_str(), fail_okay);
|
return executeSQL(strSql.c_str(), fail_okay);
|
||||||
}
|
}
|
||||||
|
|
||||||
// tells you how many rows were changed by an update or insert
|
|
||||||
virtual int getNumRowsAffected()=0;
|
|
||||||
virtual int getLastInsertID()=0;
|
|
||||||
|
|
||||||
// returns false if there are no results
|
// returns false if there are no results
|
||||||
virtual bool startIterRows(bool finalize = true)=0;
|
virtual bool startIterRows(bool finalize = true)=0;
|
||||||
virtual void endIterRows()=0;
|
virtual void endIterRows()=0;
|
||||||
|
|||||||
@@ -971,16 +971,21 @@ void NetworkOPs::mapComplete(uint256 const& hash, SHAMap::ref map)
|
|||||||
mConsensus->mapComplete(hash, map, true);
|
mConsensus->mapComplete(hash, map, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkOPs::endConsensus(bool correctLCL)
|
void NetworkOPs::endConsensus (bool correctLCL)
|
||||||
{
|
{
|
||||||
uint256 deadLedger = mLedgerMaster->getClosedLedger()->getParentHash();
|
uint256 deadLedger = mLedgerMaster->getClosedLedger()->getParentHash();
|
||||||
std::vector<Peer::pointer> peerList = theApp->getPeers().getPeerVector();
|
|
||||||
BOOST_FOREACH(Peer::ref it, peerList)
|
std::vector <Peer::pointer> peerList = theApp->getPeers().getPeerVector ();
|
||||||
|
|
||||||
|
BOOST_FOREACH(Peer::ref it, peerList)
|
||||||
|
{
|
||||||
if (it && (it->getClosedLedgerHash() == deadLedger))
|
if (it && (it->getClosedLedgerHash() == deadLedger))
|
||||||
{
|
{
|
||||||
WriteLog (lsTRACE, NetworkOPs) << "Killing obsolete peer status";
|
WriteLog (lsTRACE, NetworkOPs) << "Killing obsolete peer status";
|
||||||
it->cycleStatus();
|
it->cycleStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mConsensus = boost::shared_ptr<LedgerConsensus>();
|
mConsensus = boost::shared_ptr<LedgerConsensus>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -990,33 +995,43 @@ void NetworkOPs::consensusViewChange()
|
|||||||
setMode(omCONNECTED);
|
setMode(omCONNECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkOPs::pubServer()
|
void NetworkOPs::pubServer ()
|
||||||
{
|
{
|
||||||
boost::recursive_mutex::scoped_lock sl(mMonitorLock);
|
// VFALCO TODO Don't hold the lock across calls to send...make a copy of the
|
||||||
|
// list into a local array while holding the lock then release the
|
||||||
|
// lock and call send on everyone.
|
||||||
|
//
|
||||||
|
boost::recursive_mutex::scoped_lock sl (mMonitorLock);
|
||||||
|
|
||||||
if (!mSubServer.empty())
|
if (!mSubServer.empty ())
|
||||||
{
|
{
|
||||||
Json::Value jvObj(Json::objectValue);
|
Json::Value jvObj (Json::objectValue);
|
||||||
|
|
||||||
jvObj["type"] = "serverStatus";
|
jvObj ["type"] = "serverStatus";
|
||||||
jvObj["server_status"] = strOperatingMode();
|
jvObj ["server_status"] = strOperatingMode();
|
||||||
jvObj["load_base"] = (mLastLoadBase = theApp->getFeeTrack().getLoadBase());
|
jvObj ["load_base"] = (mLastLoadBase = theApp->getFeeTrack().getLoadBase());
|
||||||
jvObj["load_factor"] = (mLastLoadFactor = theApp->getFeeTrack().getLoadFactor());
|
jvObj ["load_factor"] = (mLastLoadFactor = theApp->getFeeTrack().getLoadFactor());
|
||||||
|
|
||||||
NetworkOPs::subMapType::const_iterator it = mSubServer.begin();
|
NetworkOPs::subMapType::const_iterator it = mSubServer.begin();
|
||||||
while (it != mSubServer.end())
|
|
||||||
{
|
|
||||||
InfoSub::pointer p = it->second.lock();
|
|
||||||
if (p)
|
|
||||||
{
|
|
||||||
p->send(jvObj, true);
|
|
||||||
++it;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
it = mSubServer.erase(it);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
while (it != mSubServer.end())
|
||||||
|
{
|
||||||
|
InfoSub::pointer p = it->second.lock();
|
||||||
|
|
||||||
|
// VFALCO TODO research the possibility of using thread queues and linearizing
|
||||||
|
// the deletion of subscribers with the sending of JSON data.
|
||||||
|
if (p)
|
||||||
|
{
|
||||||
|
p->send(jvObj, true);
|
||||||
|
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
it = mSubServer.erase(it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkOPs::setMode(OperatingMode om)
|
void NetworkOPs::setMode(OperatingMode om)
|
||||||
@@ -1662,9 +1677,11 @@ bool NetworkOPs::subBook(InfoSub::ref isrListener, const uint160& currencyPays,
|
|||||||
{
|
{
|
||||||
BookListeners::pointer listeners =
|
BookListeners::pointer listeners =
|
||||||
theApp->getOrderBookDB().makeBookListeners(currencyPays, currencyGets, issuerPays, issuerGets);
|
theApp->getOrderBookDB().makeBookListeners(currencyPays, currencyGets, issuerPays, issuerGets);
|
||||||
if (listeners)
|
|
||||||
|
if (listeners)
|
||||||
listeners->addSubscriber(isrListener);
|
listeners->addSubscriber(isrListener);
|
||||||
return true;
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NetworkOPs::unsubBook(uint64 uSeq,
|
bool NetworkOPs::unsubBook(uint64 uSeq,
|
||||||
|
|||||||
@@ -25,7 +25,22 @@ public:
|
|||||||
omFULL = 4 // we have the ledger and can even validate
|
omFULL = 4 // we have the ledger and can even validate
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef boost::unordered_map<uint64, InfoSub::wptr> subMapType;
|
#if 0
|
||||||
|
/** Subscription data interface.
|
||||||
|
*/
|
||||||
|
class Subscriber
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef boost::weak_ptr <Subscriber> WeakPtr;
|
||||||
|
|
||||||
|
/** Called every time new JSON data is available.
|
||||||
|
*/
|
||||||
|
virtual void onSubscriberReceiveJSON (Json::Value const& json) { }
|
||||||
|
};
|
||||||
|
typedef boost::unordered_map <uint64, Subscriber::WeakPtr> subMapType;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef boost::unordered_map <uint64, InfoSub::wptr> subMapType;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NetworkOPs(boost::asio::io_service& io_service, LedgerMaster* pLedgerMaster);
|
NetworkOPs(boost::asio::io_service& io_service, LedgerMaster* pLedgerMaster);
|
||||||
|
|||||||
@@ -215,10 +215,8 @@ void JobQueue::IOThread(boost::mutex::scoped_lock& sl)
|
|||||||
// do jobs until asked to stop
|
// do jobs until asked to stop
|
||||||
void JobQueue::threadEntry()
|
void JobQueue::threadEntry()
|
||||||
{
|
{
|
||||||
|
|
||||||
// VFALCO TODO Replace this mutex nonsense
|
|
||||||
//
|
|
||||||
boost::mutex::scoped_lock sl(mJobLock);
|
boost::mutex::scoped_lock sl(mJobLock);
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
setCallingThreadName("waiting");
|
setCallingThreadName("waiting");
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
// VFALCO TODO Fix this right. It's not really needed
|
// VFALCO TODO Fix this right. It's not really needed
|
||||||
// to include this file, its a hack to keep
|
// to include this file, its a hack to keep
|
||||||
// __STDC_LIMIT_MACROS from generating redefinition warnings
|
// __STDC_LIMIT_MACROS from generating redefinition warnings
|
||||||
#include "websocketpp/src/rng/boost_rng.hpp"
|
#include "websocketpp/src/rng/boost_rng.hpp"
|
||||||
|
|
||||||
// Must come first to prevent compile errors
|
// Must come first to prevent compile errors
|
||||||
|
|||||||
Reference in New Issue
Block a user