mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 19:15:54 +00:00
Replace boost::bind with BIND_TYPE where appropriate
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>_VARIADIC_MAX=8;_WIN32_WINNT=0x0600;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_VARIADIC_MAX=10;_WIN32_WINNT=0x0600;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<AdditionalIncludeDirectories>$(RepoDir);$(RepoDir)\src\cpp\protobuf\src;$(RepoDir)\src\cpp\protobuf\vsprojects;$(RepoDir)\build\proto;$(RepoDir)\Subtrees;$(RepoDir)\Subtrees\leveldb;$(RepoDir)\Subtrees\leveldb\include;$(RepoDir)\Subtrees\beast;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
|
||||
@@ -26,6 +26,28 @@
|
||||
|
||||
#include "system/ripple_OpenSSLIncludes.h"
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// From
|
||||
// http://stackoverflow.com/questions/4682343/how-to-resolve-conflict-between-boostshared-ptr-and-using-stdshared-ptr
|
||||
//
|
||||
namespace boost
|
||||
{
|
||||
template <class T>
|
||||
const T* get_pointer (std::shared_ptr<T> const& ptr)
|
||||
{
|
||||
return ptr.get();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
T* get_pointer (std::shared_ptr<T>& ptr)
|
||||
{
|
||||
return ptr.get();
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
// ByteOrder
|
||||
#ifdef WIN32
|
||||
// (nothing)
|
||||
|
||||
@@ -306,7 +306,7 @@ bool LedgerMaster::acquireMissingLedger (Ledger::ref origLedger, uint256 const&
|
||||
if (mMissingLedger->setAccept ())
|
||||
{
|
||||
if (!mMissingLedger->addOnComplete (BIND_TYPE (&LedgerMaster::missingAcquireComplete, this, P_1)))
|
||||
theApp->getIOService ().post (boost::bind (&LedgerMaster::missingAcquireComplete, this, mMissingLedger));
|
||||
theApp->getIOService ().post (BIND_TYPE (&LedgerMaster::missingAcquireComplete, this, mMissingLedger));
|
||||
}
|
||||
|
||||
int fetchMax = theConfig.getSize (siLedgerFetch);
|
||||
|
||||
@@ -312,7 +312,7 @@ void NetworkOPs::runTransactionQueue ()
|
||||
}
|
||||
|
||||
if (theApp->getTxnQueue ().stopProcessing (txn))
|
||||
theApp->getIOService ().post (boost::bind (&NetworkOPs::runTransactionQueue, this));
|
||||
theApp->getIOService ().post (BIND_TYPE (&NetworkOPs::runTransactionQueue, this));
|
||||
}
|
||||
|
||||
Transaction::pointer NetworkOPs::processTransaction (Transaction::pointer trans, bool bAdmin, bool bFailHard, stCallback callback)
|
||||
@@ -2278,7 +2278,7 @@ void NetworkOPs::gotFetchPack (bool progress, uint32 seq)
|
||||
mLastFetchPack = 0;
|
||||
mFetchSeq = seq; // earliest pack we have data on
|
||||
theApp->getJobQueue ().addJob (jtLEDGER_DATA, "gotFetchPack",
|
||||
boost::bind (&InboundLedgers::gotFetchPack, &theApp->getInboundLedgers (), _1));
|
||||
BIND_TYPE (&InboundLedgers::gotFetchPack, &theApp->getInboundLedgers (), P_1));
|
||||
}
|
||||
|
||||
void NetworkOPs::missingNodeInLedger (uint32 seq)
|
||||
|
||||
@@ -112,7 +112,7 @@ void RPCSub::send (const Json::Value& jvObj, bool broadcast)
|
||||
mSending = true;
|
||||
|
||||
WriteLog (lsINFO, RPCSub) << boost::str (boost::format ("callRPC start"));
|
||||
boost::thread (boost::bind (&RPCSub::sendThread, this)).detach ();
|
||||
boost::thread (BIND_TYPE (&RPCSub::sendThread, this)).detach ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ WSDoor* WSDoor::createWSDoor (const std::string& strIp, const int iPort, bool bP
|
||||
% strIp
|
||||
% iPort);
|
||||
|
||||
wdpResult->mThread = new boost::thread (boost::bind (&WSDoor::startListening, wdpResult));
|
||||
wdpResult->mThread = new boost::thread (BIND_TYPE (&WSDoor::startListening, wdpResult));
|
||||
|
||||
return wdpResult;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
static void ssend (connection_ptr cpClient, const std::string& strMessage, bool broadcast)
|
||||
static void ssendb (connection_ptr cpClient, const std::string& strMessage, bool broadcast)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -93,14 +93,14 @@ public:
|
||||
|
||||
void send (connection_ptr cpClient, message_ptr mpMessage)
|
||||
{
|
||||
cpClient->get_strand ().post (boost::bind (
|
||||
cpClient->get_strand ().post (BIND_TYPE (
|
||||
&WSServerHandler<endpoint_type>::ssend, cpClient, mpMessage));
|
||||
}
|
||||
|
||||
void send (connection_ptr cpClient, const std::string& strMessage, bool broadcast)
|
||||
{
|
||||
cpClient->get_strand ().post (boost::bind (
|
||||
&WSServerHandler<endpoint_type>::ssend, cpClient, strMessage, broadcast));
|
||||
cpClient->get_strand ().post (BIND_TYPE (
|
||||
&WSServerHandler<endpoint_type>::ssendb, cpClient, strMessage, broadcast));
|
||||
}
|
||||
|
||||
void send (connection_ptr cpClient, const Json::Value& jvObj, bool broadcast)
|
||||
|
||||
@@ -362,7 +362,7 @@ void Application::setup ()
|
||||
mJobQueue.setThreadCount (0, theConfig.RUN_STANDALONE);
|
||||
|
||||
mSweepTimer.expires_from_now (boost::posix_time::seconds (10));
|
||||
mSweepTimer.async_wait (boost::bind (&Application::sweep, this));
|
||||
mSweepTimer.async_wait (BIND_TYPE (&Application::sweep, this));
|
||||
|
||||
m_loadManager->startThread ();
|
||||
|
||||
@@ -391,7 +391,7 @@ void Application::setup ()
|
||||
LogPartition::setSeverity (lsDEBUG);
|
||||
}
|
||||
|
||||
boost::thread (boost::bind (runAux, boost::ref (mAuxService))).detach ();
|
||||
boost::thread (BIND_TYPE (runAux, boost::ref (mAuxService))).detach ();
|
||||
|
||||
if (!theConfig.RUN_STANDALONE)
|
||||
mSNTPClient.init (theConfig.SNTP_SERVERS);
|
||||
@@ -399,16 +399,16 @@ void Application::setup ()
|
||||
//
|
||||
// Construct databases.
|
||||
//
|
||||
boost::thread t1 (boost::bind (&InitDB, &mRpcDB, "rpc.db", RpcDBInit, RpcDBCount));
|
||||
boost::thread t2 (boost::bind (&InitDB, &mTxnDB, "transaction.db", TxnDBInit, TxnDBCount));
|
||||
boost::thread t3 (boost::bind (&InitDB, &mLedgerDB, "ledger.db", LedgerDBInit, LedgerDBCount));
|
||||
boost::thread t1 (BIND_TYPE (&InitDB, &mRpcDB, "rpc.db", RpcDBInit, RpcDBCount));
|
||||
boost::thread t2 (BIND_TYPE (&InitDB, &mTxnDB, "transaction.db", TxnDBInit, TxnDBCount));
|
||||
boost::thread t3 (BIND_TYPE (&InitDB, &mLedgerDB, "ledger.db", LedgerDBInit, LedgerDBCount));
|
||||
t1.join ();
|
||||
t2.join ();
|
||||
t3.join ();
|
||||
|
||||
boost::thread t4 (boost::bind (&InitDB, &mWalletDB, "wallet.db", WalletDBInit, WalletDBCount));
|
||||
boost::thread t6 (boost::bind (&InitDB, &mNetNodeDB, "netnode.db", NetNodeDBInit, NetNodeDBCount));
|
||||
boost::thread t7 (boost::bind (&InitDB, &mPathFindDB, "pathfind.db", PathFindDBInit, PathFindDBCount));
|
||||
boost::thread t4 (BIND_TYPE (&InitDB, &mWalletDB, "wallet.db", WalletDBInit, WalletDBCount));
|
||||
boost::thread t6 (BIND_TYPE (&InitDB, &mNetNodeDB, "netnode.db", NetNodeDBInit, NetNodeDBCount));
|
||||
boost::thread t7 (BIND_TYPE (&InitDB, &mPathFindDB, "pathfind.db", PathFindDBInit, PathFindDBCount));
|
||||
t4.join ();
|
||||
t6.join ();
|
||||
t7.join ();
|
||||
@@ -440,7 +440,7 @@ void Application::setup ()
|
||||
else
|
||||
{
|
||||
WriteLog (lsINFO, Application) << "SQLite used for nodes";
|
||||
boost::thread t5 (boost::bind (&InitDB, &mHashNodeDB, "hashnode.db", HashNodeDBInit, HashNodeDBCount));
|
||||
boost::thread t5 (BIND_TYPE (&InitDB, &mHashNodeDB, "hashnode.db", HashNodeDBInit, HashNodeDBCount));
|
||||
t5.join ();
|
||||
}
|
||||
|
||||
@@ -638,7 +638,7 @@ void Application::run ()
|
||||
{
|
||||
if (theConfig.NODE_SIZE >= 2)
|
||||
{
|
||||
boost::thread (boost::bind (runIO, boost::ref (mIOService))).detach ();
|
||||
boost::thread (BIND_TYPE (runIO, boost::ref (mIOService))).detach ();
|
||||
}
|
||||
|
||||
if (!theConfig.RUN_STANDALONE)
|
||||
@@ -688,7 +688,7 @@ void Application::sweep ()
|
||||
mNetOps.sweepFetchPack ();
|
||||
// VFALCO NOTE does the call to sweep() happen on another thread?
|
||||
mSweepTimer.expires_from_now (boost::posix_time::seconds (theConfig.getSize (siSweepInterval)));
|
||||
mSweepTimer.async_wait (boost::bind (&Application::sweep, this));
|
||||
mSweepTimer.async_wait (BIND_TYPE (&Application::sweep, this));
|
||||
}
|
||||
|
||||
Application::~Application ()
|
||||
|
||||
@@ -972,7 +972,7 @@ void LedgerConsensus::beginAccept (bool synchronous)
|
||||
accept (consensusSet, LoadEvent::pointer ());
|
||||
else
|
||||
{
|
||||
theApp->getIOService ().post (boost::bind (&LedgerConsensus::accept, shared_from_this (), consensusSet,
|
||||
theApp->getIOService ().post (BIND_TYPE (&LedgerConsensus::accept, shared_from_this (), consensusSet,
|
||||
theApp->getJobQueue ().getLoadEvent (jtACCEPTLEDGER, "LedgerConsensus::beginAccept")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,9 +255,13 @@ void PeerImp::setIpPort (const std::string& strIP, int iPort)
|
||||
|
||||
void PeerImp::detach (const char* rsn, bool onIOStrand)
|
||||
{
|
||||
// VFALCO NOTE So essentially, detach() is really two different functions
|
||||
// depending on the value of onIOStrand.
|
||||
// TODO Clean this up.
|
||||
//
|
||||
if (!onIOStrand)
|
||||
{
|
||||
mIOStrand.post (boost::bind (&Peer::detach, shared_from_this (), rsn, true));
|
||||
mIOStrand.post (BIND_TYPE (&Peer::detach, shared_from_this (), rsn, true));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -521,7 +525,7 @@ void PeerImp::sendPacket (const PackedMessage::pointer& packet, bool onStrand)
|
||||
{
|
||||
if (!onStrand)
|
||||
{
|
||||
mIOStrand.post (boost::bind (&Peer::sendPacket, shared_from_this (), packet, true));
|
||||
mIOStrand.post (BIND_TYPE (&Peer::sendPacket, shared_from_this (), packet, true));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -329,7 +329,7 @@ void Peers::policyEnforce ()
|
||||
|
||||
// Schedule next enforcement.
|
||||
mPolicyTimer.expires_at (boost::posix_time::second_clock::universal_time () + boost::posix_time::seconds (POLICY_INTERVAL_SECONDS));
|
||||
mPolicyTimer.async_wait (boost::bind (&Peers::policyHandler, this, _1));
|
||||
mPolicyTimer.async_wait (BIND_TYPE (&Peers::policyHandler, this, P_1));
|
||||
}
|
||||
|
||||
void Peers::policyHandler (const boost::system::error_code& ecResult)
|
||||
@@ -856,7 +856,7 @@ void Peers::scanRefresh ()
|
||||
// % strIpPort % tpNext % (tpNext-tpNow).total_seconds());
|
||||
|
||||
mScanTimer.expires_at (tpNext);
|
||||
mScanTimer.async_wait (boost::bind (&Peers::scanHandler, this, _1));
|
||||
mScanTimer.async_wait (BIND_TYPE (&Peers::scanHandler, this, P_1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,9 +290,9 @@ void SqliteDatabase::doHook (const char* db, int pages)
|
||||
}
|
||||
|
||||
if (mWalQ)
|
||||
mWalQ->addJob (jtWAL, std::string ("WAL:") + mHost, boost::bind (&SqliteDatabase::runWal, this));
|
||||
mWalQ->addJob (jtWAL, std::string ("WAL:") + mHost, BIND_TYPE (&SqliteDatabase::runWal, this));
|
||||
else
|
||||
boost::thread (boost::bind (&SqliteDatabase::runWal, this)).detach ();
|
||||
boost::thread (BIND_TYPE (&SqliteDatabase::runWal, this)).detach ();
|
||||
}
|
||||
|
||||
void SqliteDatabase::runWal ()
|
||||
|
||||
@@ -39,7 +39,7 @@ void TransactionAcquire::done ()
|
||||
map = mMap;
|
||||
}
|
||||
|
||||
theApp->getIOService ().post (boost::bind (&TACompletionHandler, mHash, map));
|
||||
theApp->getIOService ().post (BIND_TYPE (&TACompletionHandler, mHash, map));
|
||||
}
|
||||
|
||||
void TransactionAcquire::onTimer (bool progress)
|
||||
|
||||
@@ -725,7 +725,7 @@ void UniqueNodeList::scoreNext (bool bNow)
|
||||
|
||||
// WriteLog (lsTRACE, UniqueNodeList) << str(boost::format("scoreNext: @%s") % mtpScoreNext);
|
||||
mdtScoreTimer.expires_at (mtpScoreNext);
|
||||
mdtScoreTimer.async_wait (boost::bind (&UniqueNodeList::scoreTimerHandler, this, _1));
|
||||
mdtScoreTimer.async_wait (BIND_TYPE (&UniqueNodeList::scoreTimerHandler, this, P_1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -971,7 +971,7 @@ void UniqueNodeList::getIpsUrl (const RippleAddress& naNodePublic, Section secSi
|
||||
strPath,
|
||||
NODE_FILE_BYTES_MAX,
|
||||
boost::posix_time::seconds (NODE_FETCH_SECONDS),
|
||||
boost::bind (&UniqueNodeList::responseIps, this, strDomain, naNodePublic, _1, _2, _3));
|
||||
BIND_TYPE (&UniqueNodeList::responseIps, this, strDomain, naNodePublic, P_1, P_2, P_3));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1273,7 +1273,7 @@ void UniqueNodeList::fetchNext ()
|
||||
mtpFetchNext = tpNext;
|
||||
|
||||
mdtFetchTimer.expires_at (mtpFetchNext);
|
||||
mdtFetchTimer.async_wait (boost::bind (&UniqueNodeList::fetchTimerHandler, this, _1));
|
||||
mdtFetchTimer.async_wait (BIND_TYPE (&UniqueNodeList::fetchTimerHandler, this, P_1));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user