Replace bind with lambda (#1498)
This commit is contained in:
parent
c230110fba
commit
1f23dfd31b
1 changed files with 10 additions and 10 deletions
|
|
@ -82,7 +82,9 @@ void rai::rpc_secure::load_certs (boost::asio::ssl::context & context_a)
|
||||||
{
|
{
|
||||||
context_a.set_verify_mode (boost::asio::ssl::verify_fail_if_no_peer_cert | boost::asio::ssl::verify_peer);
|
context_a.set_verify_mode (boost::asio::ssl::verify_fail_if_no_peer_cert | boost::asio::ssl::verify_peer);
|
||||||
context_a.add_verify_path (config.secure.client_certs_path);
|
context_a.add_verify_path (config.secure.client_certs_path);
|
||||||
context_a.set_verify_callback (boost::bind (&rai::rpc_secure::on_verify_certificate, this, _1, _2));
|
context_a.set_verify_callback ([this](auto preverified, auto & ctx) {
|
||||||
|
return on_verify_certificate (preverified, ctx);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -121,11 +123,11 @@ stream (socket, rpc_a.ssl_context)
|
||||||
void rai::rpc_connection_secure::parse_connection ()
|
void rai::rpc_connection_secure::parse_connection ()
|
||||||
{
|
{
|
||||||
// Perform the SSL handshake
|
// Perform the SSL handshake
|
||||||
|
auto this_l = std::static_pointer_cast<rai::rpc_connection_secure> (shared_from_this ());
|
||||||
stream.async_handshake (boost::asio::ssl::stream_base::server,
|
stream.async_handshake (boost::asio::ssl::stream_base::server,
|
||||||
std::bind (
|
[this_l](auto & ec) {
|
||||||
&rai::rpc_connection_secure::handle_handshake,
|
this_l->handle_handshake (ec);
|
||||||
std::static_pointer_cast<rai::rpc_connection_secure> (shared_from_this ()),
|
});
|
||||||
std::placeholders::_1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void rai::rpc_connection_secure::on_shutdown (const boost::system::error_code & error)
|
void rai::rpc_connection_secure::on_shutdown (const boost::system::error_code & error)
|
||||||
|
|
@ -164,11 +166,9 @@ void rai::rpc_connection_secure::read ()
|
||||||
this_l->write_result (body, version);
|
this_l->write_result (body, version);
|
||||||
boost::beast::http::async_write (this_l->stream, this_l->res, [this_l](boost::system::error_code const & ec, size_t bytes_transferred) {
|
boost::beast::http::async_write (this_l->stream, this_l->res, [this_l](boost::system::error_code const & ec, size_t bytes_transferred) {
|
||||||
// Perform the SSL shutdown
|
// Perform the SSL shutdown
|
||||||
this_l->stream.async_shutdown (
|
this_l->stream.async_shutdown ([this_l](auto const & ec_shutdown) {
|
||||||
std::bind (
|
this_l->on_shutdown (ec_shutdown);
|
||||||
&rai::rpc_connection_secure::on_shutdown,
|
});
|
||||||
this_l,
|
|
||||||
std::placeholders::_1));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this_l->node->config.logging.log_rpc ())
|
if (this_l->node->config.logging.log_rpc ())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue