forked from boostorg/beast
Examples use bind_front_handler
This commit is contained in:
@@ -89,11 +89,9 @@ public:
|
||||
resolver_.async_resolve(
|
||||
host,
|
||||
port,
|
||||
std::bind(
|
||||
beast::bind_front_handler(
|
||||
&session::on_resolve,
|
||||
shared_from_this(),
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2));
|
||||
shared_from_this()));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -111,14 +109,13 @@ public:
|
||||
beast::async_connect(
|
||||
beast::get_lowest_layer(stream_),
|
||||
results,
|
||||
std::bind(
|
||||
beast::bind_front_handler(
|
||||
&session::on_connect,
|
||||
shared_from_this(),
|
||||
std::placeholders::_1));
|
||||
shared_from_this()));
|
||||
}
|
||||
|
||||
void
|
||||
on_connect(beast::error_code ec)
|
||||
on_connect(beast::error_code ec, tcp::resolver::results_type::endpoint_type)
|
||||
{
|
||||
if(ec)
|
||||
return fail(ec, "connect");
|
||||
@@ -126,10 +123,9 @@ public:
|
||||
// Perform the SSL handshake
|
||||
stream_.async_handshake(
|
||||
ssl::stream_base::client,
|
||||
std::bind(
|
||||
beast::bind_front_handler(
|
||||
&session::on_handshake,
|
||||
shared_from_this(),
|
||||
std::placeholders::_1));
|
||||
shared_from_this()));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -143,11 +139,9 @@ public:
|
||||
|
||||
// Send the HTTP request to the remote host
|
||||
http::async_write(stream_, req_,
|
||||
std::bind(
|
||||
beast::bind_front_handler(
|
||||
&session::on_write,
|
||||
shared_from_this(),
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2));
|
||||
shared_from_this()));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -162,11 +156,9 @@ public:
|
||||
|
||||
// Receive the HTTP response
|
||||
http::async_read(stream_, buffer_, res_,
|
||||
std::bind(
|
||||
beast::bind_front_handler(
|
||||
&session::on_read,
|
||||
shared_from_this(),
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2));
|
||||
shared_from_this()));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -187,10 +179,9 @@ public:
|
||||
|
||||
// Gracefully close the stream
|
||||
stream_.async_shutdown(
|
||||
std::bind(
|
||||
beast::bind_front_handler(
|
||||
&session::on_shutdown,
|
||||
shared_from_this(),
|
||||
std::placeholders::_1));
|
||||
shared_from_this()));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -76,11 +76,9 @@ public:
|
||||
resolver_.async_resolve(
|
||||
host,
|
||||
port,
|
||||
std::bind(
|
||||
beast::bind_front_handler(
|
||||
&session::on_resolve,
|
||||
shared_from_this(),
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2));
|
||||
shared_from_this()));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -98,14 +96,13 @@ public:
|
||||
beast::async_connect(
|
||||
stream_,
|
||||
results,
|
||||
std::bind(
|
||||
beast::bind_front_handler(
|
||||
&session::on_connect,
|
||||
shared_from_this(),
|
||||
std::placeholders::_1));
|
||||
shared_from_this()));
|
||||
}
|
||||
|
||||
void
|
||||
on_connect(beast::error_code ec)
|
||||
on_connect(beast::error_code ec, tcp::resolver::results_type::endpoint_type)
|
||||
{
|
||||
if(ec)
|
||||
return fail(ec, "connect");
|
||||
@@ -115,11 +112,9 @@ public:
|
||||
|
||||
// Send the HTTP request to the remote host
|
||||
http::async_write(stream_, req_,
|
||||
std::bind(
|
||||
beast::bind_front_handler(
|
||||
&session::on_write,
|
||||
shared_from_this(),
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2));
|
||||
shared_from_this()));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -134,11 +129,9 @@ public:
|
||||
|
||||
// Receive the HTTP response
|
||||
http::async_read(stream_, buffer_, res_,
|
||||
std::bind(
|
||||
beast::bind_front_handler(
|
||||
&session::on_read,
|
||||
shared_from_this(),
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2));
|
||||
shared_from_this()));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -217,10 +217,9 @@ public:
|
||||
timer_.async_wait(
|
||||
net::bind_executor(
|
||||
strand_,
|
||||
std::bind(
|
||||
beast::bind_front_handler(
|
||||
&worker::on_timer,
|
||||
shared_from_this(),
|
||||
std::placeholders::_1)));
|
||||
shared_from_this())));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -249,11 +248,9 @@ public:
|
||||
"http",
|
||||
net::bind_executor(
|
||||
strand_,
|
||||
std::bind(
|
||||
beast::bind_front_handler(
|
||||
&worker::on_resolve,
|
||||
shared_from_this(),
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2)));
|
||||
shared_from_this())));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -277,18 +274,16 @@ public:
|
||||
// Make the connection on the IP address we get from a lookup
|
||||
net::async_connect(
|
||||
socket_,
|
||||
results.begin(),
|
||||
results.end(),
|
||||
results,
|
||||
net::bind_executor(
|
||||
strand_,
|
||||
std::bind(
|
||||
beast::bind_front_handler(
|
||||
&worker::on_connect,
|
||||
shared_from_this(),
|
||||
std::placeholders::_1)));
|
||||
shared_from_this())));
|
||||
}
|
||||
|
||||
void
|
||||
on_connect(beast::error_code ec)
|
||||
on_connect(beast::error_code ec, tcp::resolver::results_type::endpoint_type)
|
||||
{
|
||||
if(ec)
|
||||
{
|
||||
@@ -309,11 +304,9 @@ public:
|
||||
req_,
|
||||
net::bind_executor(
|
||||
strand_,
|
||||
std::bind(
|
||||
beast::bind_front_handler(
|
||||
&worker::on_write,
|
||||
shared_from_this(),
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2)));
|
||||
shared_from_this())));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -344,11 +337,9 @@ public:
|
||||
res_,
|
||||
net::bind_executor(
|
||||
strand_,
|
||||
std::bind(
|
||||
beast::bind_front_handler(
|
||||
&worker::on_read,
|
||||
shared_from_this(),
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2)));
|
||||
shared_from_this())));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user