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:
Vinnie Falco
2014-06-15 18:26:50 -07:00
parent c00a976ff6
commit 58ec5d5afe
21 changed files with 61 additions and 680 deletions

View File

@@ -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 {

View File

@@ -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
{

View File

@@ -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
{

View File

@@ -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));
}
//--------------------------------------------------------------------------