diff --git a/BeastConfig.h b/BeastConfig.h index 1062e588ba..d31678c8b4 100644 --- a/BeastConfig.h +++ b/BeastConfig.h @@ -22,13 +22,8 @@ // beast_basics flags -#define BEAST_USE_BOOST 1 - -// VFALCO TODO Fix this problem with FreeBSD and std::bind. -// We need to enforce a minimum library/g++ version. -// -#if __FreeBSD__ -#define BEAST_BIND_USES_BOOST 1 +#ifndef BEAST_USE_BOOST +#define BEAST_USE_BOOST 0 #endif #ifndef BEAST_USE_LEAKCHECKED diff --git a/Builds/VisualStudio2012/RippleD.props b/Builds/VisualStudio2012/RippleD.props index 6a999d5fdb..e97a5bdc9b 100644 --- a/Builds/VisualStudio2012/RippleD.props +++ b/Builds/VisualStudio2012/RippleD.props @@ -12,7 +12,7 @@ - _VARIADIC_MAX=10;_WIN32_WINNT=0x0600;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;%(PreprocessorDefinitions) + _WIN32_WINNT=0x0600;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;%(PreprocessorDefinitions) true Level3 $(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) diff --git a/Subtrees/beast/modules/beast_basics/beast_basics.h b/Subtrees/beast/modules/beast_basics/beast_basics.h index e7226faa19..1fd550f3f5 100644 --- a/Subtrees/beast/modules/beast_basics/beast_basics.h +++ b/Subtrees/beast/modules/beast_basics/beast_basics.h @@ -222,12 +222,12 @@ @todo Discuss the treatment of exceptions versus Error objects in the library. - @todo Discuss the additions to BeastConfig.h + @todo Discuss the additions to AppConfig.h @defgroup beast_core beast_core */ -/* See the JUCE notes regarding BeastConfig.h +/* See the Juce notes regarding AppConfig.h This file must always be included before any Juce headers. @@ -238,7 +238,7 @@ /* BeastConfig.h must be included before this file */ /* Use sensible default configurations if they forgot - to append the necessary macros into their BeastConfig.h. + to append the necessary macros into their AppConfig.h. */ #ifndef BEAST_USE_BOOST #define BEAST_USE_BOOST 0 @@ -286,57 +286,6 @@ //------------------------------------------------------------------------------ -// This is a hack to fix boost's goofy placeholders -#if BEAST_USE_BOOST -#ifdef BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED -#error must not be included before this file -#endif -// Prevent from being included -#define BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED -#include -#include -// This is from -namespace boost { -namespace placeholders { -#if defined(__BORLANDC__) || defined(__GNUC__) && (__GNUC__ < 4) -static inline boost::arg<1> _1() { return boost::arg<1>(); } -static inline boost::arg<2> _2() { return boost::arg<2>(); } -static inline boost::arg<3> _3() { return boost::arg<3>(); } -static inline boost::arg<4> _4() { return boost::arg<4>(); } -static inline boost::arg<5> _5() { return boost::arg<5>(); } -static inline boost::arg<6> _6() { return boost::arg<6>(); } -static inline boost::arg<7> _7() { return boost::arg<7>(); } -static inline boost::arg<8> _8() { return boost::arg<8>(); } -static inline boost::arg<9> _9() { return boost::arg<9>(); } -#elif defined(BOOST_MSVC) || (defined(__DECCXX_VER) && __DECCXX_VER <= 60590031) || defined(__MWERKS__) || \ - defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ < 2) -static boost::arg<1> _1; -static boost::arg<2> _2; -static boost::arg<3> _3; -static boost::arg<4> _4; -static boost::arg<5> _5; -static boost::arg<6> _6; -static boost::arg<7> _7; -static boost::arg<8> _8; -static boost::arg<9> _9; -#else -boost::arg<1> _1; -boost::arg<2> _2; -boost::arg<3> _3; -boost::arg<4> _4; -boost::arg<5> _5; -boost::arg<6> _6; -boost::arg<7> _7; -boost::arg<8> _8; -boost::arg<9> _9; -#endif -} -using namespace placeholders; -} -#endif - -//------------------------------------------------------------------------------ - // Choose a source of bind, placeholders, and function #if !BEAST_BIND_USES_STD && !BEAST_BIND_USES_TR1 && !BEAST_BIND_USES_BOOST diff --git a/Subtrees/beast/modules/beast_basics/functor/beast_Bind.h b/Subtrees/beast/modules/beast_basics/functor/beast_Bind.h index 0e4f64fc3b..e41dc4ce89 100644 --- a/Subtrees/beast/modules/beast_basics/functor/beast_Bind.h +++ b/Subtrees/beast/modules/beast_basics/functor/beast_Bind.h @@ -20,17 +20,7 @@ #ifndef BEAST_BIND_BEASTHEADER #define BEAST_BIND_BEASTHEADER -// VFALCO TODO Rename this file to beast_Functional.h - -/* Brings functional support into our namespace, based on environment. - - Notes on bind - - Difference between boost::bind and std::bind - http://stackoverflow.com/questions/10555566/is-there-any-difference-between-c11-stdbind-and-boostbind - - Resolving conflict between boost::shared_ptr and std::shared_ptr - http://stackoverflow.com/questions/4682343/how-to-resolve-conflict-between-boostshared-ptr-and-using-stdshared-ptr +/* Brings functional support into our namespace, based on environment. */ #ifndef BEAST_BIND_PLACEHOLDERS_N @@ -58,7 +48,6 @@ #if BEAST_BIND_USES_STD using std::ref; -using std::cref; using std::bind; using std::function; @@ -147,7 +136,6 @@ using std::placeholders::_20; #elif BEAST_BIND_USES_TR1 using std::tr1::ref; -using std::tr1::cref; using std::tr1::bind; using std::tr1::function; @@ -236,7 +224,6 @@ using std::tr1::placeholders::_20; #elif BEAST_BIND_USES_BOOST using boost::ref; -using boost::cref; using boost::bind; using boost::function; diff --git a/Subtrees/websocket/src/roles/server.hpp b/Subtrees/websocket/src/roles/server.hpp index 5f4ae1500e..1c2ea938f5 100644 --- a/Subtrees/websocket/src/roles/server.hpp +++ b/Subtrees/websocket/src/roles/server.hpp @@ -551,13 +551,10 @@ void server::connection::async_init() { m_connection.register_timeout(5000,fail::status::TIMEOUT_WS, "Timeout on WebSocket handshake"); - static boost::arg<1> pl1; - static boost::arg<2> pl2; - boost::shared_ptr stringPtr = boost::make_shared(); m_connection.get_socket().async_read_until( m_connection.buffer(), - boost::bind(&match_header, stringPtr, pl1, pl2), + boost::bind(&match_header, stringPtr, _1, _2), m_connection.get_strand().wrap(boost::bind( &type::handle_read_request, m_connection.shared_from_this(), diff --git a/TODO.txt b/TODO.txt index 6bcc26dd24..29fce90d62 100644 --- a/TODO.txt +++ b/TODO.txt @@ -2,13 +2,6 @@ TODO -------------------------------------------------------------------------------- -- Make beast::HashMap support assignment via operator[] -- Rewrite TxFormats to use beast containers and RAII, and not leak -- Add ICore interface -- Make TxFormats a member of ICore instead of a singleton. - -- Rename LoadMonitor to LoadMeter, change LoadEvent to LoadMeter::ScopedSample - - Fix all leaks on exit (!) Say there's a leak, a ledger that can never be accessed is locked in some @@ -30,6 +23,8 @@ TODO - Remove "ENABLE_INSECURE" when the time is right. +- lift bind, function, and placeholders into ripple namespace +- lift beast into the ripple namespace, remove ripple's duplicated integer types - lift unique_ptr / auto_ptr into ripple namespace, or replace with ScopedPointer - Make LevelDB and Ripple code work with both Unicode and non-Unicode Windows APIs diff --git a/modules/ripple_app/ripple_app.cpp b/modules/ripple_app/ripple_app.cpp index 27e5baf09f..b0cb6ea470 100644 --- a/modules/ripple_app/ripple_app.cpp +++ b/modules/ripple_app/ripple_app.cpp @@ -12,11 +12,6 @@ //------------------------------------------------------------------------------ -#include "BeastConfig.h" - -// This must come first to work around the boost placeholders issues -#include "modules/beast_basics/beast_basics.h" - // VFALCO NOTE Holy smokes...that's a lot of boost!!! #include #include @@ -29,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -75,6 +71,8 @@ #include "../ripple_data/ripple_data.h" + + #include "../modules/ripple_websocket/ripple_websocket.h" //------------------------------------------------------------------------------ diff --git a/modules/ripple_basics/ripple_basics.cpp b/modules/ripple_basics/ripple_basics.cpp index 1fa03c5901..bfe86eb8f7 100644 --- a/modules/ripple_basics/ripple_basics.cpp +++ b/modules/ripple_basics/ripple_basics.cpp @@ -10,8 +10,6 @@ @ingroup ripple_basics */ -#include "BeastConfig.h" - #include "ripple_basics.h" // VFALCO TODO Rewrite Sustain to use beast::Process diff --git a/modules/ripple_basics/ripple_basics.h b/modules/ripple_basics/ripple_basics.h index e3d21a9ae0..5c605e5882 100644 --- a/modules/ripple_basics/ripple_basics.h +++ b/modules/ripple_basics/ripple_basics.h @@ -22,35 +22,10 @@ #include "system/ripple_StandardIncludes.h" -// This must come before Boost, to fix the boost placeholders problem -#include "modules/beast_basics/beast_basics.h" - #include "system/ripple_BoostIncludes.h" #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 - const T* get_pointer (std::shared_ptr const& ptr) - { - return ptr.get(); - } - - template - T* get_pointer (std::shared_ptr& ptr) - { - return ptr.get(); - } -} - -//------------------------------------------------------------------------------ - // ByteOrder #ifdef WIN32 // (nothing) @@ -62,8 +37,10 @@ namespace boost # include #endif +#include "BeastConfig.h" // Must come before any Beast includes + #include "modules/beast_core/beast_core.h" -//#include "modules/beast_basics/beast_basics.h" +#include "modules/beast_basics/beast_basics.h" // VFALCO TODO Fix this for FreeBSD //#include "modules/beast_basics/beast_basics.h" @@ -73,7 +50,17 @@ namespace boost namespace ripple { -using namespace beast; +// VFALCO TODO Make this work. We have to get rid of BIND_TYPE, +// FUNC_TYPE, and P_* placeholders. +// +//using namespace beast; + +using beast::int16; +using beast::int32; +using beast::int64; +using beast::uint16; +using beast::uint32; +using beast::uint64; #include "utility/ripple_Log.h" // Needed by others diff --git a/modules/ripple_basics/utility/ripple_PlatformMacros.h b/modules/ripple_basics/utility/ripple_PlatformMacros.h index 75beb8aa9c..86e081918e 100644 --- a/modules/ripple_basics/utility/ripple_PlatformMacros.h +++ b/modules/ripple_basics/utility/ripple_PlatformMacros.h @@ -7,30 +7,36 @@ #ifndef RIPPLE_PLATFORMMACROS_H #define RIPPLE_PLATFORMMACROS_H -#define FUNCTION_TYPE beast::function -#define BIND_TYPE beast::bind -#define P_1 beast::_1 -#define P_2 beast::_2 -#define P_3 beast::_3 -#define P_4 beast::_4 - // VFALCO TODO Clean this up #if (!defined(FORCE_NO_C11X) && (__cplusplus > 201100L)) || defined(FORCE_C11X) -// VFALCO TODO Get rid of the C11X macro +// VFALCO TODO replace BIND_TYPE with a namespace lift + #define C11X #define UPTR_T std::unique_ptr #define MOVE_P(p) std::move(p) +#define BIND_TYPE std::bind +#define FUNCTION_TYPE std::function +#define P_1 std::placeholders::_1 +#define P_2 std::placeholders::_2 +#define P_3 std::placeholders::_3 +#define P_4 std::placeholders::_4 #else #define UPTR_T std::auto_ptr #define MOVE_P(p) (p) +#define BIND_TYPE boost::bind +#define FUNCTION_TYPE boost::function +#define P_1 _1 +#define P_2 _2 +#define P_3 _3 +#define P_4 _4 #endif -// VFALCO TODO Clean this stuff up. Remove as much as possible +// VFALCO TODO Clean this junk up #define nothing() do {} while (0) #define fallthru() do {} while (0) #define NUMBER(x) (sizeof(x)/sizeof((x)[0])) diff --git a/modules/ripple_core/functional/ripple_JobQueue.h b/modules/ripple_core/functional/ripple_JobQueue.h index 6526f90b32..3c4f80d173 100644 --- a/modules/ripple_core/functional/ripple_JobQueue.h +++ b/modules/ripple_core/functional/ripple_JobQueue.h @@ -12,9 +12,6 @@ class JobQueue public: explicit JobQueue (boost::asio::io_service&); - // VFALCO TODO make convenience functions that allow the caller to not - // have to call bind. - // void addJob (JobType type, const std::string& name, const FUNCTION_TYPE& job); int getJobCount (JobType t); // Jobs waiting at this priority diff --git a/modules/ripple_core/ripple_core.cpp b/modules/ripple_core/ripple_core.cpp index 96b4a79e13..3116573ac2 100644 --- a/modules/ripple_core/ripple_core.cpp +++ b/modules/ripple_core/ripple_core.cpp @@ -10,8 +10,6 @@ @ingroup ripple_core */ -#include "BeastConfig.h" - #include "ripple_core.h" #include diff --git a/modules/ripple_data/ripple_data.cpp b/modules/ripple_data/ripple_data.cpp index 43b1f80803..0f5ebce4ad 100644 --- a/modules/ripple_data/ripple_data.cpp +++ b/modules/ripple_data/ripple_data.cpp @@ -10,8 +10,6 @@ @ingroup ripple_data */ -#include "BeastConfig.h" - #include "ripple_data.h" #include diff --git a/modules/ripple_json/ripple_json.cpp b/modules/ripple_json/ripple_json.cpp index 419905dcc7..9c2bbc7038 100644 --- a/modules/ripple_json/ripple_json.cpp +++ b/modules/ripple_json/ripple_json.cpp @@ -10,8 +10,6 @@ @ingroup ripple_json */ -#include "BeastConfig.h" - #include "ripple_json.h" #include diff --git a/modules/ripple_leveldb/ripple_leveldb.cpp b/modules/ripple_leveldb/ripple_leveldb.cpp index abc46ef9f8..ed230e1945 100644 --- a/modules/ripple_leveldb/ripple_leveldb.cpp +++ b/modules/ripple_leveldb/ripple_leveldb.cpp @@ -6,8 +6,6 @@ // Unity build file for LevelDB -#include "BeastConfig.h" - #include "ripple_leveldb.h" #include "beast/modules/beast_core/system/beast_TargetPlatform.h" diff --git a/modules/ripple_sqlite/ripple_sqlite.c b/modules/ripple_sqlite/ripple_sqlite.c index ae8c03ab18..6da2c4012c 100644 --- a/modules/ripple_sqlite/ripple_sqlite.c +++ b/modules/ripple_sqlite/ripple_sqlite.c @@ -10,8 +10,6 @@ @ingroup ripple_sqlite */ -#include "BeastConfig.h" - // This prevents sqlite.h from being included // #define RIPPLE_SQLITE_MODULE_INCLUDED 1 diff --git a/modules/ripple_websocket/autosocket/ripple_AutoSocket.h b/modules/ripple_websocket/autosocket/ripple_AutoSocket.h index 5c016a543b..0c5c422b31 100644 --- a/modules/ripple_websocket/autosocket/ripple_AutoSocket.h +++ b/modules/ripple_websocket/autosocket/ripple_AutoSocket.h @@ -90,7 +90,7 @@ public: mSocket->set_verify_mode (boost::asio::ssl::verify_peer); // XXX Verify semantics of RFC 2818 are what we want. - mSocket->set_verify_callback (boost::bind (&rfc2818_verify, strDomain, boost::placeholders::_1, boost::placeholders::_2), ec); + mSocket->set_verify_callback (boost::bind (&rfc2818_verify, strDomain, _1, _2), ec); return ec; } diff --git a/modules/ripple_websocket/ripple_websocket.cpp b/modules/ripple_websocket/ripple_websocket.cpp index 402f4c81f3..4785cb9650 100644 --- a/modules/ripple_websocket/ripple_websocket.cpp +++ b/modules/ripple_websocket/ripple_websocket.cpp @@ -4,8 +4,6 @@ */ //============================================================================== -#include "BeastConfig.h" - #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif diff --git a/src/cpp/ripple/CallRPC.h b/src/cpp/ripple/CallRPC.h index bb0d2cf1e6..3bfefe7d03 100644 --- a/src/cpp/ripple/CallRPC.h +++ b/src/cpp/ripple/CallRPC.h @@ -66,7 +66,7 @@ extern void callRPC ( const std::string& strUsername, const std::string& strPassword, const std::string& strPath, const std::string& strMethod, const Json::Value& jvParams, const bool bSSL, - FUNCTION_TYPE callbackFuncP = FUNCTION_TYPE ()); + FUNCTION_TYPE callbackFuncP = 0); #endif // vim:ts=4 diff --git a/src/cpp/ripple/LedgerMaster.cpp b/src/cpp/ripple/LedgerMaster.cpp index dc337b13dd..de1a90a8bd 100644 --- a/src/cpp/ripple/LedgerMaster.cpp +++ b/src/cpp/ripple/LedgerMaster.cpp @@ -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 (BIND_TYPE (&LedgerMaster::missingAcquireComplete, this, mMissingLedger)); + theApp->getIOService ().post (boost::bind (&LedgerMaster::missingAcquireComplete, this, mMissingLedger)); } int fetchMax = theConfig.getSize (siLedgerFetch); diff --git a/src/cpp/ripple/NetworkOPs.cpp b/src/cpp/ripple/NetworkOPs.cpp index 00e0978a1d..cbdbcdd6c7 100644 --- a/src/cpp/ripple/NetworkOPs.cpp +++ b/src/cpp/ripple/NetworkOPs.cpp @@ -312,7 +312,7 @@ void NetworkOPs::runTransactionQueue () } if (theApp->getTxnQueue ().stopProcessing (txn)) - theApp->getIOService ().post (BIND_TYPE (&NetworkOPs::runTransactionQueue, this)); + theApp->getIOService ().post (boost::bind (&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", - BIND_TYPE (&InboundLedgers::gotFetchPack, &theApp->getInboundLedgers (), P_1)); + boost::bind (&InboundLedgers::gotFetchPack, &theApp->getInboundLedgers (), _1)); } void NetworkOPs::missingNodeInLedger (uint32 seq) diff --git a/src/cpp/ripple/RPCSub.cpp b/src/cpp/ripple/RPCSub.cpp index 3521a3d42c..9a1b8781c7 100644 --- a/src/cpp/ripple/RPCSub.cpp +++ b/src/cpp/ripple/RPCSub.cpp @@ -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 (BIND_TYPE (&RPCSub::sendThread, this)).detach (); + boost::thread (boost::bind (&RPCSub::sendThread, this)).detach (); } } diff --git a/src/cpp/ripple/WSDoor.cpp b/src/cpp/ripple/WSDoor.cpp index bcf4e8f0e8..feb2667c87 100644 --- a/src/cpp/ripple/WSDoor.cpp +++ b/src/cpp/ripple/WSDoor.cpp @@ -82,7 +82,7 @@ WSDoor* WSDoor::createWSDoor (const std::string& strIp, const int iPort, bool bP % strIp % iPort); - wdpResult->mThread = new boost::thread (BIND_TYPE (&WSDoor::startListening, wdpResult)); + wdpResult->mThread = new boost::thread (boost::bind (&WSDoor::startListening, wdpResult)); return wdpResult; } diff --git a/src/cpp/ripple/WSHandler.h b/src/cpp/ripple/WSHandler.h index c6b2f367cf..1e72241502 100644 --- a/src/cpp/ripple/WSHandler.h +++ b/src/cpp/ripple/WSHandler.h @@ -77,7 +77,7 @@ public: } } - static void ssendb (connection_ptr cpClient, const std::string& strMessage, bool broadcast) + static void ssend (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 (BIND_TYPE ( + cpClient->get_strand ().post (boost::bind ( &WSServerHandler::ssend, cpClient, mpMessage)); } void send (connection_ptr cpClient, const std::string& strMessage, bool broadcast) { - cpClient->get_strand ().post (BIND_TYPE ( - &WSServerHandler::ssendb, cpClient, strMessage, broadcast)); + cpClient->get_strand ().post (boost::bind ( + &WSServerHandler::ssend, cpClient, strMessage, broadcast)); } void send (connection_ptr cpClient, const Json::Value& jvObj, bool broadcast) diff --git a/src/cpp/ripple/ripple_Application.cpp b/src/cpp/ripple/ripple_Application.cpp index b406a7197a..6220b42c19 100644 --- a/src/cpp/ripple/ripple_Application.cpp +++ b/src/cpp/ripple/ripple_Application.cpp @@ -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 (BIND_TYPE (&Application::sweep, this)); + mSweepTimer.async_wait (boost::bind (&Application::sweep, this)); m_loadManager->startThread (); @@ -391,7 +391,7 @@ void Application::setup () LogPartition::setSeverity (lsDEBUG); } - boost::thread (BIND_TYPE (runAux, boost::ref (mAuxService))).detach (); + boost::thread (boost::bind (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 (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)); + 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)); t1.join (); t2.join (); t3.join (); - 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)); + 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)); t4.join (); t6.join (); t7.join (); @@ -440,7 +440,7 @@ void Application::setup () else { WriteLog (lsINFO, Application) << "SQLite used for nodes"; - boost::thread t5 (BIND_TYPE (&InitDB, &mHashNodeDB, "hashnode.db", HashNodeDBInit, HashNodeDBCount)); + boost::thread t5 (boost::bind (&InitDB, &mHashNodeDB, "hashnode.db", HashNodeDBInit, HashNodeDBCount)); t5.join (); } @@ -638,7 +638,7 @@ void Application::run () { if (theConfig.NODE_SIZE >= 2) { - boost::thread (BIND_TYPE (runIO, boost::ref (mIOService))).detach (); + boost::thread (boost::bind (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 (BIND_TYPE (&Application::sweep, this)); + mSweepTimer.async_wait (boost::bind (&Application::sweep, this)); } Application::~Application () diff --git a/src/cpp/ripple/ripple_LedgerConsensus.cpp b/src/cpp/ripple/ripple_LedgerConsensus.cpp index 07a06ecd0f..9accf3174b 100644 --- a/src/cpp/ripple/ripple_LedgerConsensus.cpp +++ b/src/cpp/ripple/ripple_LedgerConsensus.cpp @@ -972,7 +972,7 @@ void LedgerConsensus::beginAccept (bool synchronous) accept (consensusSet, LoadEvent::pointer ()); else { - theApp->getIOService ().post (BIND_TYPE (&LedgerConsensus::accept, shared_from_this (), consensusSet, + theApp->getIOService ().post (boost::bind (&LedgerConsensus::accept, shared_from_this (), consensusSet, theApp->getJobQueue ().getLoadEvent (jtACCEPTLEDGER, "LedgerConsensus::beginAccept"))); } } diff --git a/src/cpp/ripple/ripple_Peer.cpp b/src/cpp/ripple/ripple_Peer.cpp index 80b1fbb5f5..279f4757fe 100644 --- a/src/cpp/ripple/ripple_Peer.cpp +++ b/src/cpp/ripple/ripple_Peer.cpp @@ -255,13 +255,9 @@ 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 (BIND_TYPE (&Peer::detach, shared_from_this (), rsn, true)); + mIOStrand.post (boost::bind (&Peer::detach, shared_from_this (), rsn, true)); return; } @@ -525,7 +521,7 @@ void PeerImp::sendPacket (const PackedMessage::pointer& packet, bool onStrand) { if (!onStrand) { - mIOStrand.post (BIND_TYPE (&Peer::sendPacket, shared_from_this (), packet, true)); + mIOStrand.post (boost::bind (&Peer::sendPacket, shared_from_this (), packet, true)); return; } @@ -1289,10 +1285,6 @@ void PeerImp::recvHaveTxSet (protocol::TMHaveTransactionSet& packet) } uint256 hash; - - // VFALCO TODO There should be no use of memcpy() throughout the program. - // TODO Clean up this magic number - // memcpy (hash.begin (), packet.hash ().data (), 32); if (packet.status () == protocol::tsHAVE) diff --git a/src/cpp/ripple/ripple_Peers.cpp b/src/cpp/ripple/ripple_Peers.cpp index f2d5559bcd..b96596ad01 100644 --- a/src/cpp/ripple/ripple_Peers.cpp +++ b/src/cpp/ripple/ripple_Peers.cpp @@ -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 (BIND_TYPE (&Peers::policyHandler, this, P_1)); + mPolicyTimer.async_wait (boost::bind (&Peers::policyHandler, this, _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 (BIND_TYPE (&Peers::scanHandler, this, P_1)); + mScanTimer.async_wait (boost::bind (&Peers::scanHandler, this, _1)); } } } diff --git a/src/cpp/ripple/ripple_SqliteDatabase.cpp b/src/cpp/ripple/ripple_SqliteDatabase.cpp index 360af20265..0c28aa1a26 100644 --- a/src/cpp/ripple/ripple_SqliteDatabase.cpp +++ b/src/cpp/ripple/ripple_SqliteDatabase.cpp @@ -290,9 +290,9 @@ void SqliteDatabase::doHook (const char* db, int pages) } if (mWalQ) - mWalQ->addJob (jtWAL, std::string ("WAL:") + mHost, BIND_TYPE (&SqliteDatabase::runWal, this)); + mWalQ->addJob (jtWAL, std::string ("WAL:") + mHost, boost::bind (&SqliteDatabase::runWal, this)); else - boost::thread (BIND_TYPE (&SqliteDatabase::runWal, this)).detach (); + boost::thread (boost::bind (&SqliteDatabase::runWal, this)).detach (); } void SqliteDatabase::runWal () diff --git a/src/cpp/ripple/ripple_TransactionAcquire.cpp b/src/cpp/ripple/ripple_TransactionAcquire.cpp index fbb49a06b8..84df233288 100644 --- a/src/cpp/ripple/ripple_TransactionAcquire.cpp +++ b/src/cpp/ripple/ripple_TransactionAcquire.cpp @@ -39,7 +39,7 @@ void TransactionAcquire::done () map = mMap; } - theApp->getIOService ().post (BIND_TYPE (&TACompletionHandler, mHash, map)); + theApp->getIOService ().post (boost::bind (&TACompletionHandler, mHash, map)); } void TransactionAcquire::onTimer (bool progress) diff --git a/src/cpp/ripple/ripple_UniqueNodeList.cpp b/src/cpp/ripple/ripple_UniqueNodeList.cpp index cc59e7c37b..0d88883374 100644 --- a/src/cpp/ripple/ripple_UniqueNodeList.cpp +++ b/src/cpp/ripple/ripple_UniqueNodeList.cpp @@ -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 (BIND_TYPE (&UniqueNodeList::scoreTimerHandler, this, P_1)); + mdtScoreTimer.async_wait (boost::bind (&UniqueNodeList::scoreTimerHandler, this, _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), - BIND_TYPE (&UniqueNodeList::responseIps, this, strDomain, naNodePublic, P_1, P_2, P_3)); + boost::bind (&UniqueNodeList::responseIps, this, strDomain, naNodePublic, _1, _2, _3)); } else { @@ -1273,7 +1273,7 @@ void UniqueNodeList::fetchNext () mtpFetchNext = tpNext; mdtFetchTimer.expires_at (mtpFetchNext); - mdtFetchTimer.async_wait (BIND_TYPE (&UniqueNodeList::fetchTimerHandler, this, P_1)); + mdtFetchTimer.async_wait (boost::bind (&UniqueNodeList::fetchTimerHandler, this, _1)); } else {