diff --git a/BeastConfig.h b/BeastConfig.h index 491d22bcc7..1062e588ba 100644 --- a/BeastConfig.h +++ b/BeastConfig.h @@ -24,7 +24,7 @@ #define BEAST_USE_BOOST 1 -// VFALCO TODO Fix this hack for using boost on FreeBSD +// VFALCO TODO Fix this problem with FreeBSD and std::bind. // We need to enforce a minimum library/g++ version. // #if __FreeBSD__ diff --git a/Subtrees/beast/modules/beast_basics/beast_basics.cpp b/Subtrees/beast/modules/beast_basics/beast_basics.cpp index 4a62756512..f366a436ad 100644 --- a/Subtrees/beast/modules/beast_basics/beast_basics.cpp +++ b/Subtrees/beast/modules/beast_basics/beast_basics.cpp @@ -54,16 +54,6 @@ namespace beast #include "threads/beast_InterruptibleThread.cpp" #include "threads/beast_Semaphore.cpp" -#if BEAST_WINDOWS -#include "native/beast_win32_FPUFlags.cpp" -#include "native/beast_win32_Threads.cpp" - -#else -#include "native/beast_posix_FPUFlags.cpp" -#include "native/beast_posix_Threads.cpp" - -#endif - #if BEAST_USE_BOOST #include "memory/beast_FifoFreeStoreWithTLS.cpp" #else @@ -82,8 +72,35 @@ namespace beast #include "threads/beast_ThreadGroup.cpp" #include "threads/beast_ThreadWithCallQueue.cpp" +#if BEAST_WINDOWS +#include "native/beast_win32_FPUFlags.cpp" +#include "native/beast_win32_Threads.cpp" + +#else +#include "native/beast_posix_FPUFlags.cpp" +#include "native/beast_posix_Threads.cpp" + +#endif } #if BEAST_MSVC #pragma warning (pop) #endif + +//------------------------------------------------------------------------------ + +#if BEAST_USE_BOOST +namespace boost { +namespace placeholders { +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 diff --git a/Subtrees/beast/modules/beast_basics/beast_basics.h b/Subtrees/beast/modules/beast_basics/beast_basics.h index 1fd550f3f5..ec08e90d8c 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 AppConfig.h + @todo Discuss the additions to BeastConfig.h @defgroup beast_core beast_core */ -/* See the Juce notes regarding AppConfig.h +/* See the JUCE notes regarding BeastConfig.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 AppConfig.h. + to append the necessary macros into their BeastConfig.h. */ #ifndef BEAST_USE_BOOST #define BEAST_USE_BOOST 0 @@ -286,6 +286,34 @@ //------------------------------------------------------------------------------ +// 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 based on +namespace boost { +namespace placeholders { +extern boost::arg<1> _1; +extern boost::arg<2> _2; +extern boost::arg<3> _3; +extern boost::arg<4> _4; +extern boost::arg<5> _5; +extern boost::arg<6> _6; +extern boost::arg<7> _7; +extern boost::arg<8> _8; +extern boost::arg<9> _9; +} +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 8c45e6eb45..a7a697eea1 100644 --- a/Subtrees/beast/modules/beast_basics/functor/beast_Bind.h +++ b/Subtrees/beast/modules/beast_basics/functor/beast_Bind.h @@ -241,83 +241,83 @@ using boost::bind; using boost::function; #if BEAST_BIND_PLACEHOLDERS_N >= 1 -using ::_1; +using boost::placeholders::_1; #endif #if BEAST_BIND_PLACEHOLDERS_N >= 2 -using ::_2; +using boost::placeholders::_2; #endif #if BEAST_BIND_PLACEHOLDERS_N >= 3 -using ::_3; +using boost::placeholders::_3; #endif #if BEAST_BIND_PLACEHOLDERS_N >= 4 -using ::_4; +using boost::placeholders::_4; #endif #if BEAST_BIND_PLACEHOLDERS_N >= 5 -using ::_5; +using boost::placeholders::_5; #endif #if BEAST_BIND_PLACEHOLDERS_N >= 6 -using ::_6; +using boost::placeholders::_6; #endif #if BEAST_BIND_PLACEHOLDERS_N >= 7 -using ::_7; +using boost::placeholders::_7; #endif #if BEAST_BIND_PLACEHOLDERS_N >= 8 -using ::_8; +using boost::placeholders::_8; #endif #if BEAST_BIND_PLACEHOLDERS_N >= 9 -using ::_9; +using boost::placeholders::_9; #endif #if BEAST_BIND_PLACEHOLDERS_N >= 10 -using ::_10; +using boost::placeholders::_10; #endif #if BEAST_BIND_PLACEHOLDERS_N >= 11 -using ::_11; +using boost::placeholders::_11; #endif #if BEAST_BIND_PLACEHOLDERS_N >= 12 -using ::_12; +using boost::placeholders::_12; #endif #if BEAST_BIND_PLACEHOLDERS_N >= 13 -using ::_13; +using boost::placeholders::_13; #endif #if BEAST_BIND_PLACEHOLDERS_N >= 14 -using ::_14; +using boost::placeholders::_14; #endif #if BEAST_BIND_PLACEHOLDERS_N >= 15 -using ::_15; +using boost::placeholders::_15; #endif #if BEAST_BIND_PLACEHOLDERS_N >= 16 -using ::_16; +using boost::placeholders::_16; #endif #if BEAST_BIND_PLACEHOLDERS_N >= 17 -using ::_17; +using boost::placeholders::_17; #endif #if BEAST_BIND_PLACEHOLDERS_N >= 18 -using ::_18; +using boost::placeholders::_18; #endif #if BEAST_BIND_PLACEHOLDERS_N >= 19 -using ::_19; +using boost::placeholders::_19; #endif #if BEAST_BIND_PLACEHOLDERS_N >= 20 -using ::_20; +using boost::placeholders::_20; #endif //------------------------------------------------------------------------------ diff --git a/Subtrees/websocket/src/roles/server.hpp b/Subtrees/websocket/src/roles/server.hpp index 1c2ea938f5..5f4ae1500e 100644 --- a/Subtrees/websocket/src/roles/server.hpp +++ b/Subtrees/websocket/src/roles/server.hpp @@ -551,10 +551,13 @@ 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, _1, _2), + boost::bind(&match_header, stringPtr, pl1, pl2), 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 04fbd221e9..6bcc26dd24 100644 --- a/TODO.txt +++ b/TODO.txt @@ -2,6 +2,13 @@ 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 @@ -23,13 +30,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 -- Rewrite functions passed to bind to not take reference parameters, so we can - used std::bind instead of boost. - - Make LevelDB and Ripple code work with both Unicode and non-Unicode Windows APIs - Raise the warning level and fix everything diff --git a/modules/ripple_app/ripple_app.cpp b/modules/ripple_app/ripple_app.cpp index 69689b9161..27e5baf09f 100644 --- a/modules/ripple_app/ripple_app.cpp +++ b/modules/ripple_app/ripple_app.cpp @@ -14,6 +14,9 @@ #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 @@ -26,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/modules/ripple_basics/ripple_basics.h b/modules/ripple_basics/ripple_basics.h index 8530726052..9b2376ddf5 100644 --- a/modules/ripple_basics/ripple_basics.h +++ b/modules/ripple_basics/ripple_basics.h @@ -22,6 +22,9 @@ #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" @@ -62,7 +65,7 @@ namespace boost #endif #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" @@ -72,17 +75,7 @@ namespace boost namespace ripple { -// 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; +using namespace beast; #include "utility/ripple_Log.h" // Needed by others diff --git a/modules/ripple_websocket/autosocket/ripple_AutoSocket.h b/modules/ripple_websocket/autosocket/ripple_AutoSocket.h index 0c5c422b31..5c016a543b 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, _1, _2), ec); + mSocket->set_verify_callback (boost::bind (&rfc2818_verify, strDomain, boost::placeholders::_1, boost::placeholders::_2), ec); return ec; }