mirror of
https://github.com/boostorg/beast.git
synced 2025-07-30 21:07:26 +02:00
Fix portability bug in websocket server sync example
fixes #2032 closes #2034
This commit is contained in:
@ -1,3 +1,6 @@
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 299:
|
||||
|
||||
* Fix race in http-crawl example.
|
||||
|
@ -38,7 +38,7 @@ using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>
|
||||
|
||||
// Echoes back all received WebSocket messages
|
||||
void
|
||||
do_session(tcp::socket& socket, ssl::context& ctx)
|
||||
do_session(tcp::socket socket, ssl::context& ctx)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -123,10 +123,10 @@ int main(int argc, char* argv[])
|
||||
acceptor.accept(socket);
|
||||
|
||||
// Launch the session, transferring ownership of the socket
|
||||
std::thread{std::bind(
|
||||
std::thread(
|
||||
&do_session,
|
||||
std::move(socket),
|
||||
std::ref(ctx))}.detach();
|
||||
std::ref(ctx)).detach();
|
||||
}
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
|
@ -32,7 +32,7 @@ using tcp = boost::asio::ip::tcp; // from <boost/asio/ip/tcp.hpp>
|
||||
|
||||
// Echoes back all received WebSocket messages
|
||||
void
|
||||
do_session(tcp::socket& socket)
|
||||
do_session(tcp::socket socket)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -108,9 +108,9 @@ int main(int argc, char* argv[])
|
||||
acceptor.accept(socket);
|
||||
|
||||
// Launch the session, transferring ownership of the socket
|
||||
std::thread{std::bind(
|
||||
std::thread(
|
||||
&do_session,
|
||||
std::move(socket))}.detach();
|
||||
std::move(socket)).detach();
|
||||
}
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
|
Reference in New Issue
Block a user