mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Add beast::asio::ssl_bundle workaround:
This works around the limitation that 1.56 boost::asio::ssl::stream objects do not support r-value move or construction. It is required when the stream does not own the socket.
This commit is contained in:
@@ -161,6 +161,8 @@
|
|||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\src\beast\beast\asio\ssl.h">
|
<ClInclude Include="..\..\src\beast\beast\asio\ssl.h">
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\beast\beast\asio\ssl_bundle.h">
|
||||||
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\beast\beast\asio\tests\bind_handler.test.cpp">
|
<ClCompile Include="..\..\src\beast\beast\asio\tests\bind_handler.test.cpp">
|
||||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|||||||
@@ -663,6 +663,9 @@
|
|||||||
<ClInclude Include="..\..\src\beast\beast\asio\ssl.h">
|
<ClInclude Include="..\..\src\beast\beast\asio\ssl.h">
|
||||||
<Filter>beast\asio</Filter>
|
<Filter>beast\asio</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\beast\beast\asio\ssl_bundle.h">
|
||||||
|
<Filter>beast\asio</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClCompile Include="..\..\src\beast\beast\asio\tests\bind_handler.test.cpp">
|
<ClCompile Include="..\..\src\beast\beast\asio\tests\bind_handler.test.cpp">
|
||||||
<Filter>beast\asio\tests</Filter>
|
<Filter>beast\asio\tests</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
|||||||
57
src/beast/beast/asio/ssl_bundle.h
Normal file
57
src/beast/beast/asio/ssl_bundle.h
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
/*
|
||||||
|
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||||
|
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
//==============================================================================
|
||||||
|
|
||||||
|
#ifndef BEAST_ASIO_SSL_BUNDLE_H_INCLUDED
|
||||||
|
#define BEAST_ASIO_SSL_BUNDLE_H_INCLUDED
|
||||||
|
|
||||||
|
#include <boost/asio/ip/tcp.hpp>
|
||||||
|
#include <boost/asio/ssl/stream.hpp>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
namespace beast {
|
||||||
|
namespace asio {
|
||||||
|
|
||||||
|
/** Work-around for non-movable boost::ssl::stream.
|
||||||
|
This allows ssl::stream to be movable and allows the stream to
|
||||||
|
construct from an already-existing socket.
|
||||||
|
*/
|
||||||
|
struct ssl_bundle
|
||||||
|
{
|
||||||
|
typedef boost::asio::ip::tcp::socket socket_type;
|
||||||
|
typedef boost::asio::ssl::stream <socket_type&> stream_type;
|
||||||
|
|
||||||
|
template <class... Args>
|
||||||
|
ssl_bundle (boost::asio::ssl::context& context, Args&&... args);
|
||||||
|
|
||||||
|
socket_type socket;
|
||||||
|
stream_type stream;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class... Args>
|
||||||
|
ssl_bundle::ssl_bundle (boost::asio::ssl::context& context,
|
||||||
|
Args&&... args)
|
||||||
|
: socket(std::forward<Args>(args)...)
|
||||||
|
, stream (socket, context)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
} // asio
|
||||||
|
} // beast
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
#include <ripple/http/impl/Peer.h>
|
#include <ripple/http/impl/Peer.h>
|
||||||
#include <boost/asio/buffer.hpp>
|
#include <boost/asio/buffer.hpp>
|
||||||
#include <beast/asio/placeholders.h>
|
#include <beast/asio/placeholders.h>
|
||||||
|
#include <beast/asio/ssl_bundle.h>
|
||||||
#include <boost/logic/tribool.hpp>
|
#include <boost/logic/tribool.hpp>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user