mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Tidy up includes:
* Replace boost with std equivalents: - bind, ref, cref, function, placeholders * More "include what you use" * Remove unnecessary includes
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
#include <beast/asio/wrap_handler.h>
|
||||
#include <beast/asio/placeholders.h>
|
||||
#include <beast/unit_test/suite.h>
|
||||
|
||||
#include <boost/asio/ssl/stream.hpp>
|
||||
#include <beast/cxx14/memory.h> // <memory>
|
||||
|
||||
namespace beast {
|
||||
@@ -71,8 +71,8 @@ public:
|
||||
{
|
||||
result_type result;
|
||||
boost::asio::io_service io_service;
|
||||
async_get (io_service, url, beast::bind (
|
||||
&HTTPClientType::handle_get, beast::placeholders::_1, &result));
|
||||
async_get (io_service, url, std::bind (
|
||||
&HTTPClientType::handle_get, std::placeholders::_1, &result));
|
||||
io_service.run ();
|
||||
return result;
|
||||
}
|
||||
@@ -656,8 +656,8 @@ public:
|
||||
HTTPClientBase::New (Journal(), timeoutSeconds));
|
||||
|
||||
client->async_get (t.get_io_service (), ParsedURL (s).url (),
|
||||
beast::bind (&HTTPClient_test::handle_get, this,
|
||||
beast::_1));
|
||||
std::bind (&HTTPClient_test::handle_get, this,
|
||||
std::placeholders::_1));
|
||||
|
||||
t.start ();
|
||||
t.join ();
|
||||
|
||||
@@ -38,22 +38,6 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Unfortunately, we use some boost detail elements
|
||||
//
|
||||
// https://svn.boost.org/trac/boost/ticket/9024
|
||||
|
||||
#include <boost/version.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/asio/ssl.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <boost/asio/detail/handler_alloc_helpers.hpp>
|
||||
#include <boost/asio/detail/handler_invoke_helpers.hpp>
|
||||
#include <boost/asio/detail/handler_cont_helpers.hpp>
|
||||
|
||||
// work-around for broken <boost/get_pointer.hpp>
|
||||
#include <beast/boost/get_pointer.h>
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#ifndef BEAST_ASIO_TESTS_TESTPEERBASICS_H_INCLUDED
|
||||
#define BEAST_ASIO_TESTS_TESTPEERBASICS_H_INCLUDED
|
||||
|
||||
#include <boost/asio/ssl/stream_base.hpp>
|
||||
|
||||
namespace beast {
|
||||
namespace asio {
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <beast/asio/placeholders.h>
|
||||
|
||||
namespace beast {
|
||||
namespace asio {
|
||||
|
||||
@@ -43,8 +45,8 @@ void TestPeerLogicAsyncClient::on_connect_async (error_code const& ec)
|
||||
if (socket ().needs_handshake ())
|
||||
{
|
||||
socket ().async_handshake (abstract_socket::client,
|
||||
boost::bind (&TestPeerLogicAsyncClient::on_handshake, this,
|
||||
boost::asio::placeholders::error));
|
||||
std::bind (&TestPeerLogicAsyncClient::on_handshake, this,
|
||||
beast::asio::placeholders::error));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -58,8 +60,9 @@ void TestPeerLogicAsyncClient::on_handshake (error_code const& ec)
|
||||
return finished ();
|
||||
|
||||
boost::asio::async_write (socket (), boost::asio::buffer ("hello", 5),
|
||||
boost::bind (&TestPeerLogicAsyncClient::on_write, this,
|
||||
boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred));
|
||||
std::bind (&TestPeerLogicAsyncClient::on_write, this,
|
||||
beast::asio::placeholders::error,
|
||||
beast::asio::placeholders::bytes_transferred));
|
||||
}
|
||||
|
||||
void TestPeerLogicAsyncClient::on_write (error_code const& ec, std::size_t bytes_transferred)
|
||||
@@ -71,8 +74,8 @@ void TestPeerLogicAsyncClient::on_write (error_code const& ec, std::size_t bytes
|
||||
return finished ();
|
||||
|
||||
boost::asio::async_read_until (socket (), m_buf, std::string ("goodbye"),
|
||||
boost::bind (&TestPeerLogicAsyncClient::on_read, this,
|
||||
boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred));
|
||||
std::bind (&TestPeerLogicAsyncClient::on_read, this,
|
||||
beast::asio::placeholders::error, beast::asio::placeholders::bytes_transferred));
|
||||
}
|
||||
|
||||
void TestPeerLogicAsyncClient::on_read (error_code const& ec, std::size_t bytes_transferred)
|
||||
@@ -89,8 +92,8 @@ void TestPeerLogicAsyncClient::on_read (error_code const& ec, std::size_t bytes_
|
||||
// Fire up a 1 byte read, to wait for the server to
|
||||
// shut down its end of the connection.
|
||||
boost::asio::async_read (socket (), m_buf.prepare (1),
|
||||
boost::bind (&TestPeerLogicAsyncClient::on_read_final, this,
|
||||
boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred));
|
||||
std::bind (&TestPeerLogicAsyncClient::on_read_final, this,
|
||||
beast::asio::placeholders::error, beast::asio::placeholders::bytes_transferred));
|
||||
}
|
||||
|
||||
void TestPeerLogicAsyncClient::on_read_final (error_code const& ec, std::size_t)
|
||||
@@ -104,8 +107,8 @@ void TestPeerLogicAsyncClient::on_read_final (error_code const& ec, std::size_t)
|
||||
{
|
||||
if (socket ().needs_handshake ())
|
||||
{
|
||||
socket ().async_shutdown (boost::bind (&TestPeerLogicAsyncClient::on_shutdown, this,
|
||||
boost::asio::placeholders::error));
|
||||
socket ().async_shutdown (std::bind (&TestPeerLogicAsyncClient::on_shutdown, this,
|
||||
beast::asio::placeholders::error));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <beast/asio/placeholders.h>
|
||||
|
||||
namespace beast {
|
||||
namespace asio {
|
||||
|
||||
@@ -43,8 +45,8 @@ void TestPeerLogicAsyncServer::on_connect_async (error_code const& ec)
|
||||
if (socket ().needs_handshake ())
|
||||
{
|
||||
socket ().async_handshake (abstract_socket::server,
|
||||
boost::bind (&TestPeerLogicAsyncServer::on_handshake, this,
|
||||
boost::asio::placeholders::error));
|
||||
std::bind (&TestPeerLogicAsyncServer::on_handshake, this,
|
||||
beast::asio::placeholders::error));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -58,8 +60,8 @@ void TestPeerLogicAsyncServer::on_handshake (error_code const& ec)
|
||||
return finished ();
|
||||
|
||||
boost::asio::async_read_until (socket (), m_buf, std::string ("hello"),
|
||||
boost::bind (&TestPeerLogicAsyncServer::on_read, this,
|
||||
boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred));
|
||||
std::bind (&TestPeerLogicAsyncServer::on_read, this,
|
||||
beast::asio::placeholders::error, beast::asio::placeholders::bytes_transferred));
|
||||
}
|
||||
|
||||
void TestPeerLogicAsyncServer::on_read (error_code const& ec, std::size_t bytes_transferred)
|
||||
@@ -71,8 +73,8 @@ void TestPeerLogicAsyncServer::on_read (error_code const& ec, std::size_t bytes_
|
||||
return finished ();
|
||||
|
||||
boost::asio::async_write (socket (), boost::asio::buffer ("goodbye", 7),
|
||||
boost::bind (&TestPeerLogicAsyncServer::on_write, this,
|
||||
boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred));
|
||||
std::bind (&TestPeerLogicAsyncServer::on_write, this,
|
||||
beast::asio::placeholders::error, beast::asio::placeholders::bytes_transferred));
|
||||
}
|
||||
|
||||
void TestPeerLogicAsyncServer::on_write (error_code const& ec, std::size_t bytes_transferred)
|
||||
@@ -85,8 +87,8 @@ void TestPeerLogicAsyncServer::on_write (error_code const& ec, std::size_t bytes
|
||||
|
||||
if (socket ().needs_handshake ())
|
||||
{
|
||||
socket ().async_shutdown (boost::bind (&TestPeerLogicAsyncServer::on_shutdown, this,
|
||||
boost::asio::placeholders::error));
|
||||
socket ().async_shutdown (std::bind (&TestPeerLogicAsyncServer::on_shutdown, this,
|
||||
beast::asio::placeholders::error));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#ifndef BEAST_ASIO_TESTS_TESTPEERTYPE_H_INCLUDED
|
||||
#define BEAST_ASIO_TESTS_TESTPEERTYPE_H_INCLUDED
|
||||
|
||||
#include <beast/asio/placeholders.h>
|
||||
|
||||
namespace beast {
|
||||
namespace asio {
|
||||
|
||||
@@ -98,8 +100,8 @@ public:
|
||||
m_timer.expires_from_now (
|
||||
boost::posix_time::seconds (timeoutSeconds));
|
||||
|
||||
m_timer.async_wait (boost::bind (&This::on_deadline,
|
||||
this, boost::asio::placeholders::error));
|
||||
m_timer.async_wait (std::bind (&This::on_deadline,
|
||||
this, beast::asio::placeholders::error));
|
||||
|
||||
m_timer_set = true;
|
||||
}
|
||||
@@ -270,8 +272,8 @@ public:
|
||||
if (failure (error ()))
|
||||
return finished ();
|
||||
|
||||
get_acceptor ().async_accept (get_socket (), boost::bind (
|
||||
&This::on_accept, this, boost::asio::placeholders::error));
|
||||
get_acceptor ().async_accept (get_socket (), std::bind (
|
||||
&This::on_accept, this, beast::asio::placeholders::error));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -289,7 +291,8 @@ public:
|
||||
void run_async_client ()
|
||||
{
|
||||
get_native_socket ().async_connect (get_endpoint (get_role ()),
|
||||
boost::bind (&Logic::on_connect_async, this, boost::asio::placeholders::error));
|
||||
std::bind (&Logic::on_connect_async, this,
|
||||
beast::asio::placeholders::error));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user