example/cppcon2018 only requires C++11

This commit is contained in:
Vinnie Falco
2018-11-22 17:28:57 -08:00
parent cf6021a355
commit a5d5c7500a
4 changed files with 39 additions and 38 deletions

View File

@@ -1,6 +1,7 @@
Version 190:
* Fix broken doc link
* example/cppcon2018 only requires C++11
--------------------------------------------------------------------------------

View File

@@ -203,11 +203,11 @@ run()
{
// Read a request
http::async_read(socket_, buffer_, req_,
[self = shared_from_this()]
(error_code ec, std::size_t bytes)
{
self->on_read(ec, bytes);
});
std::bind(
&http_session::on_read,
shared_from_this(),
std::placeholders::_1,
std::placeholders::_2));
}
// Report a failure
@@ -341,9 +341,9 @@ on_write(error_code ec, std::size_t, bool close)
// Read another request
http::async_read(socket_, buffer_, req_,
[self = shared_from_this()]
(error_code ec, std::size_t bytes)
{
self->on_read(ec, bytes);
});
std::bind(
&http_session::on_read,
shared_from_this(),
std::placeholders::_1,
std::placeholders::_2));
}

View File

@@ -63,10 +63,10 @@ run()
// Start accepting a connection
acceptor_.async_accept(
socket_,
[self = shared_from_this()](error_code ec)
{
self->on_accept(ec);
});
std::bind(
&listener::on_accept,
shared_from_this(),
std::placeholders::_1));
}
// Report a failure
@@ -96,8 +96,8 @@ on_accept(error_code ec)
// Accept another connection
acceptor_.async_accept(
socket_,
[self = shared_from_this()](error_code ec)
{
self->on_accept(ec);
});
std::bind(
&listener::on_accept,
shared_from_this(),
std::placeholders::_1));
}

View File

@@ -51,11 +51,11 @@ on_accept(error_code ec)
// Read a message
ws_.async_read(
buffer_,
[sp = shared_from_this()](
error_code ec, std::size_t bytes)
{
sp->on_read(ec, bytes);
});
std::bind(
&websocket_session::on_read,
shared_from_this(),
std::placeholders::_1,
std::placeholders::_2));
}
void
@@ -75,11 +75,11 @@ on_read(error_code ec, std::size_t)
// Read another message
ws_.async_read(
buffer_,
[sp = shared_from_this()](
error_code ec, std::size_t bytes)
{
sp->on_read(ec, bytes);
});
std::bind(
&websocket_session::on_read,
shared_from_this(),
std::placeholders::_1,
std::placeholders::_2));
}
void
@@ -96,11 +96,11 @@ send(std::shared_ptr<std::string const> const& ss)
// We are not currently writing, so send this immediately
ws_.async_write(
net::buffer(*queue_.front()),
[sp = shared_from_this()](
error_code ec, std::size_t bytes)
{
sp->on_write(ec, bytes);
});
std::bind(
&websocket_session::on_write,
shared_from_this(),
std::placeholders::_1,
std::placeholders::_2));
}
void
@@ -118,9 +118,9 @@ on_write(error_code ec, std::size_t)
if(! queue_.empty())
ws_.async_write(
net::buffer(*queue_.front()),
[sp = shared_from_this()](
error_code ec, std::size_t bytes)
{
sp->on_write(ec, bytes);
});
std::bind(
&websocket_session::on_write,
shared_from_this(),
std::placeholders::_1,
std::placeholders::_2));
}