diff --git a/Builds/QtCreator/rippled.pro b/Builds/QtCreator/rippled.pro
index 81dcc8a54f..be35e5bf47 100644
--- a/Builds/QtCreator/rippled.pro
+++ b/Builds/QtCreator/rippled.pro
@@ -59,6 +59,7 @@ OTHER_FILES += \
UI_HEADERS_DIR += ../../modules/ripple_basics
SOURCES += \
+ ../../Subtrees/beast/modules/beast_asio/beast_asio.cpp \
../../Subtrees/beast/modules/beast_basics/beast_basics.cpp \
../../Subtrees/beast/modules/beast_core/beast_core.cpp \
../../Subtrees/beast/modules/beast_crypto/beast_crypto.cpp \
diff --git a/Builds/VisualStudio2012/RippleD.vcxproj b/Builds/VisualStudio2012/RippleD.vcxproj
index ad75918cd6..ae47f3533f 100644
--- a/Builds/VisualStudio2012/RippleD.vcxproj
+++ b/Builds/VisualStudio2012/RippleD.vcxproj
@@ -1030,6 +1030,7 @@
+
diff --git a/Builds/VisualStudio2012/RippleD.vcxproj.filters b/Builds/VisualStudio2012/RippleD.vcxproj.filters
index f860072d13..9642ec31dc 100644
--- a/Builds/VisualStudio2012/RippleD.vcxproj.filters
+++ b/Builds/VisualStudio2012/RippleD.vcxproj.filters
@@ -891,6 +891,9 @@
[1] Ripple\ripple_basio\tests
+
+ [0] Subtrees\beast
+
diff --git a/SConstruct b/SConstruct
index 8dae719925..783de19e83 100644
--- a/SConstruct
+++ b/SConstruct
@@ -118,6 +118,7 @@ INCLUDE_PATHS = [
]
COMPILED_FILES = [
+ 'Subtrees/beast/modules/beast_asio/beast_asio.cpp',
'Subtrees/beast/modules/beast_basics/beast_basics.cpp',
'Subtrees/beast/modules/beast_core/beast_core.cpp',
'Subtrees/beast/modules/beast_crypto/beast_crypto.cpp',
diff --git a/modules/ripple_basio/ripple_basio.cpp b/modules/ripple_basio/ripple_basio.cpp
index 368630d3d1..35b32c9c72 100644
--- a/modules/ripple_basio/ripple_basio.cpp
+++ b/modules/ripple_basio/ripple_basio.cpp
@@ -15,6 +15,7 @@
#include "BeastConfig.h"
#include "beast/modules/beast_basics/beast_basics.h"
+#include "beast/modules/beast_asio/beast_asio.h"
#include "ripple_basio.h"
diff --git a/modules/ripple_basio/tests/ripple_AsioTests.cpp b/modules/ripple_basio/tests/ripple_AsioTests.cpp
index 641dc7db45..623e5a2b5a 100644
--- a/modules/ripple_basio/tests/ripple_AsioTests.cpp
+++ b/modules/ripple_basio/tests/ripple_AsioTests.cpp
@@ -8,1121 +8,10 @@
#define BOOST_ASIO_INITFN_RESULT_TYPE(expr,val) void
#endif
-/** Provides abstract interface for parts of boost::asio */
-namespace Asio
-{
-
-using namespace boost;
-
-//------------------------------------------------------------------------------
-
-/** A high level socket abstraction.
-
- This combines the capabilities of multiple socket interfaces such
- as listening, connecting, streaming, and handshaking. It brings
- everything together into a single abstract interface.
-
- When member functions are called and the underlying implementation does
- not support the operation, a fatal error is generated.
-
- Must satisfy these requirements:
-
- DefaultConstructible, MoveConstructible, CopyConstructible,
- MoveAssignable, CopyAssignable, Destructible
-
- Meets the requirements of these boost concepts:
-
- SyncReadStream, SyncWriteStream, AsyncReadStream, AsyncWriteStream,
-
- @see SharedObjectPtr
-*/
-class AbstractSocket
- : public asio::ssl::stream_base
- , public asio::socket_base
-{
-protected:
- //--------------------------------------------------------------------------
- //
- // Buffers
- //
- //--------------------------------------------------------------------------
-
- /** Storage for a BufferSequence.
-
- Meets these requirements:
- BufferSequence
- ConstBufferSequence (when Buffer is mutable_buffer)
- MutableBufferSequence (when Buffer is const_buffer)
- */
- template
- class Buffers
- {
- public:
- typedef Buffer value_type;
- typedef typename std::vector ::const_iterator const_iterator;
-
- Buffers ()
- : m_size (0)
- {
- }
-
- template
- explicit Buffers (OtherBuffers const& buffers)
- : m_size (0)
- {
- m_buffers.reserve (std::distance (buffers.begin (), buffers.end ()));
- BOOST_FOREACH (typename OtherBuffers::value_type buffer, buffers)
- {
- m_size += asio::buffer_size (buffer);
- m_buffers.push_back (buffer);
- }
- }
-
- /** Determine the total size of all buffers.
- This is faster than calling asio::buffer_size.
- */
- std::size_t size () const noexcept
- {
- return m_size;
- }
-
- const_iterator begin () const noexcept
- {
- return m_buffers.begin ();
- }
-
- const_iterator end () const noexcept
- {
- return m_buffers.end ();
- }
-
- /** Retrieve a consumed BufferSequence. */
- Buffers consumed (std::size_t bytes) const
- {
- Buffers result;
- result.m_buffers.reserve (m_buffers.size ());
- BOOST_FOREACH (Buffer buffer, m_buffers)
- {
- std::size_t const have = asio::buffer_size (buffer);
- std::size_t const reduce = std::min (bytes, have);
- bytes -= reduce;
-
- if (have > reduce)
- result.m_buffers.push_back (buffer + reduce);
- }
- return result;
- }
-
- private:
- std::size_t m_size;
- std::vector m_buffers;
- };
-
- /** Meets the requirements of ConstBufferSequence */
- typedef Buffers ConstBuffers;
-
- /** Meets the requirements of MutableBufferSequence */
- typedef Buffers MutableBuffers;
-
- //--------------------------------------------------------------------------
- //
- // Handler abstractions
- //
- //--------------------------------------------------------------------------
-
- // Meets these requirements:
- //
- // CompletionHandler
- // http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/CompletionHandler.html
- //
- class CompletionCall
- {
- public:
- typedef void result_type;
-
- template
- CompletionCall (BOOST_ASIO_MOVE_ARG (Handler) handler)
- : m_call (new CallType (handler))
- {
- }
-
- CompletionCall (CompletionCall const& other)
- : m_call (other.m_call)
- {
- }
-
- void operator() ()
- {
- (*m_call) ();
- }
-
- private:
- struct Call : SharedObject, LeakChecked
- {
- virtual void operator() () = 0;
- };
-
- template
- struct CallType : Call
- {
- CallType (BOOST_ASIO_MOVE_ARG (Handler) handler)
- : m_handler (handler)
- {
- }
-
- void operator() ()
- {
- m_handler ();
- }
-
- Handler m_handler;
- };
-
- private:
- SharedObjectPtr m_call;
- };
-
- // Meets these requirements:
- //
- // AcceptHandler
- // http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/AcceptHandler.html
- //
- // ConnectHandler
- // http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/ConnectHandler.html
- //
- // ShutdownHandler
- // http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/ShutdownHandler.html
- //
- // HandshakeHandler
- // http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/HandshakeHandler.html
- //
- class ErrorCall
- {
- public:
- typedef void result_type;
-
- template
- ErrorCall (BOOST_ASIO_MOVE_ARG (Handler) handler)
- : m_call (new CallType (handler))
- {
- }
-
- ErrorCall (ErrorCall const& other)
- : m_call (other.m_call)
- {
- }
-
- void operator() (system::error_code const& ec)
- {
- (*m_call) (ec);
- }
-
- private:
- struct Call : SharedObject, LeakChecked
- {
- virtual void operator() (system::error_code const&) = 0;
- };
-
- template
- struct CallType : Call
- {
- CallType (BOOST_ASIO_MOVE_ARG (Handler) handler)
- : m_handler (handler)
- {
- }
-
- void operator() (system::error_code const& ec)
- {
- m_handler (ec);
- }
-
- Handler m_handler;
- };
-
- private:
- SharedObjectPtr m_call;
- };
-
- // Meets these requirements
- //
- // ReadHandler
- // http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/ReadHandler.html
- //
- // WriteHandler
- // http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/WriteHandler.html
- //
- // BUfferedHandshakeHandler
- // http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/BufferedHandshakeHandler.html
- //
- class TransferCall
- {
- public:
- typedef void result_type;
-
- template
- TransferCall (BOOST_ASIO_MOVE_ARG (Handler) handler)
- : m_call (new CallType (handler))
- {
- }
-
- TransferCall (TransferCall const& other)
- : m_call (other.m_call)
- {
- }
-
- void operator() (system::error_code const& ec, std::size_t bytes_transferred)
- {
- (*m_call) (ec, bytes_transferred);
- }
-
- private:
- struct Call : SharedObject, LeakChecked
- {
- virtual void operator() (system::error_code const&, std::size_t) = 0;
- };
-
- template
- struct CallType : Call
- {
- CallType (BOOST_ASIO_MOVE_ARG (Handler) handler)
- : m_handler (handler)
- {
- }
-
- void operator() (system::error_code const& ec, std::size_t bytes_transferred)
- {
- m_handler (ec, bytes_transferred);
- }
-
- Handler m_handler;
- };
-
- private:
- SharedObjectPtr m_call;
- };
-
-public:
- typedef SharedObjectPtr Ptr;
-
- virtual ~AbstractSocket () { }
-
- //--------------------------------------------------------------------------
- //
- // General attributes
- //
- //--------------------------------------------------------------------------
-
- /** Determines if the underlying stream requires a handshake.
-
- If is_handshaked is true, it will be necessary to call handshake or
- async_handshake after the connection is established. Furthermore it
- will be necessary to call the shutdown member from the
- HandshakeInterface to close the connection. Do not close the underlying
- socket or else the closure will not be graceful. Only one side should
- initiate the handshaking shutdon. The other side should observe it.
- Which side does what is up to the user.
- */
- virtual bool is_handshaked () = 0;
-
- /** Retrieve the underlying object.
- Returns nullptr if the implementation doesn't match. Usually
- you will use this if you need to get at the underlying boost::asio
- object. For example:
-
- @code
-
- void set_options (AbstractSocket& socket)
- {
- bost::asio::ip::tcp::socket* sock =
- socket.native_object ();
-
- if (sock != nullptr)
- sock->set_option (
- boost::asio::ip::tcp::no_delay (true));
- }
-
- @endcode
- */
- template
- Object* native_object ()
- {
- void* const object = native_object_raw ();
- if (object != nullptr)
- return dynamic_cast