Skip to content

Commit

Permalink
Remove unused functions and clean up some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vinniefalco committed Jun 11, 2013
1 parent e3d844d commit a70ede6
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 60 deletions.
6 changes: 3 additions & 3 deletions modules/ripple_basics/utility/ripple_InstanceCounter.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef 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.
//

Expand Down Expand Up @@ -38,7 +38,7 @@ class InstanceType
public:
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;
sHeadInstance = this;
Expand All @@ -65,7 +65,7 @@ class InstanceType
{
if (sMultiThreaded)
{
// VFALCO NOTE Junk that will go away with atomics
// VFALCO NOTE This will go away with atomics
mLock.lock();
++mInstances;
mLock.unlock();
Expand Down
2 changes: 1 addition & 1 deletion modules/ripple_basics/utility/ripple_RandomNumbers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ bool RandomNumbers::platformAddEntropy ()

void RandomNumbers::platformAddPerformanceMonitorEntropy ()
{
// VFALCO This is how we simulate local functions
// VFALCO TODO Remove all this fancy stuff
struct
{
int64 operator() () const
Expand Down
5 changes: 4 additions & 1 deletion modules/ripple_basics/utility/ripple_Sustain.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
#ifndef 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 std::string StopSustain();
extern std::string DoSustain();
Expand Down
2 changes: 0 additions & 2 deletions modules/ripple_data/protocol/ripple_LedgerFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ std::map <int, LedgerEntryFormat*> LedgerEntryFormat::byType;

std::map <std::string, LedgerEntryFormat*> LedgerEntryFormat::byName;

// VFALCO TODO surely we can think of a better way than macros?

#define LEF_BASE \
<< SOElement(sfLedgerIndex, SOE_OPTIONAL) \
<< SOElement(sfLedgerEntryType, SOE_REQUIRED) \
Expand Down
2 changes: 1 addition & 1 deletion modules/ripple_data/protocol/ripple_SerializedTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_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_ONE get_u160_one() // Used as a place holder.
#define CURRENCY_BAD uint160(0x5852500000000000) // Do not allow XRP as an IOU currency.
Expand Down
14 changes: 0 additions & 14 deletions src/cpp/database/SqliteDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,6 @@ bool SqliteDatabase::executeSQL(const char* sql, bool fail_ok)
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
bool SqliteDatabase::startIterRows(bool finalize)
{
Expand Down
1 change: 0 additions & 1 deletion src/cpp/database/SqliteDatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class SqliteDatabase : public Database

// tells you how many rows were changed by an update or insert
int getNumRowsAffected();
int getLastInsertID();

// returns false if there are no results
bool startIterRows(bool finalize);
Expand Down
4 changes: 0 additions & 4 deletions src/cpp/database/database.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ class Database
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
virtual bool startIterRows(bool finalize = true)=0;
virtual void endIterRows()=0;
Expand Down
71 changes: 44 additions & 27 deletions src/cpp/ripple/NetworkOPs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -971,16 +971,21 @@ void NetworkOPs::mapComplete(uint256 const& hash, SHAMap::ref map)
mConsensus->mapComplete(hash, map, true);
}

void NetworkOPs::endConsensus(bool correctLCL)
void NetworkOPs::endConsensus (bool correctLCL)
{
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))
{
WriteLog (lsTRACE, NetworkOPs) << "Killing obsolete peer status";
it->cycleStatus();
}
}

mConsensus = boost::shared_ptr<LedgerConsensus>();
}

Expand All @@ -990,33 +995,43 @@ void NetworkOPs::consensusViewChange()
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())
{
Json::Value jvObj(Json::objectValue);
if (!mSubServer.empty ())
{
Json::Value jvObj (Json::objectValue);

jvObj["type"] = "serverStatus";
jvObj["server_status"] = strOperatingMode();
jvObj["load_base"] = (mLastLoadBase = theApp->getFeeTrack().getLoadBase());
jvObj["load_factor"] = (mLastLoadFactor = theApp->getFeeTrack().getLoadFactor());
jvObj ["type"] = "serverStatus";
jvObj ["server_status"] = strOperatingMode();
jvObj ["load_base"] = (mLastLoadBase = theApp->getFeeTrack().getLoadBase());
jvObj ["load_factor"] = (mLastLoadFactor = theApp->getFeeTrack().getLoadFactor());

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);
}
NetworkOPs::subMapType::const_iterator it = mSubServer.begin();

}
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)
Expand Down Expand Up @@ -1662,9 +1677,11 @@ bool NetworkOPs::subBook(InfoSub::ref isrListener, const uint160& currencyPays,
{
BookListeners::pointer listeners =
theApp->getOrderBookDB().makeBookListeners(currencyPays, currencyGets, issuerPays, issuerGets);
if (listeners)

if (listeners)
listeners->addSubscriber(isrListener);
return true;

return true;
}

bool NetworkOPs::unsubBook(uint64 uSeq,
Expand Down
17 changes: 16 additions & 1 deletion src/cpp/ripple/NetworkOPs.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,22 @@ class NetworkOPs
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:
NetworkOPs(boost::asio::io_service& io_service, LedgerMaster* pLedgerMaster);
Expand Down
4 changes: 1 addition & 3 deletions src/cpp/ripple/ripple_JobQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,8 @@ void JobQueue::IOThread(boost::mutex::scoped_lock& sl)
// do jobs until asked to stop
void JobQueue::threadEntry()
{

// VFALCO TODO Replace this mutex nonsense
//
boost::mutex::scoped_lock sl(mJobLock);

while (1)
{
setCallingThreadName("waiting");
Expand Down
4 changes: 2 additions & 2 deletions src/cpp/websocket_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
//

// VFALCO TODO Fix this right. It's not really needed
// to include this file, its a hack to keep
// __STDC_LIMIT_MACROS from generating redefinition warnings
// to include this file, its a hack to keep
// __STDC_LIMIT_MACROS from generating redefinition warnings
#include "websocketpp/src/rng/boost_rng.hpp"

// Must come first to prevent compile errors
Expand Down

0 comments on commit a70ede6

Please sign in to comment.