mirror of
https://github.com/boostorg/beast.git
synced 2025-07-29 20:37:31 +02:00
std::bind is superfluous in some examples
This commit is contained in:
committed by
Mohammad Nejati
parent
cf72589ae9
commit
6dd3cf7ab1
@ -213,7 +213,7 @@ fail(beast::error_code ec, char const* what)
|
||||
// Handles an HTTP server connection
|
||||
void
|
||||
do_session(
|
||||
tcp::socket& socket,
|
||||
tcp::socket socket,
|
||||
ssl::context& ctx,
|
||||
std::shared_ptr<std::string const> const& doc_root)
|
||||
{
|
||||
@ -308,11 +308,11 @@ int main(int argc, char* argv[])
|
||||
acceptor.accept(socket);
|
||||
|
||||
// Launch the session, transferring ownership of the socket
|
||||
std::thread{std::bind(
|
||||
&do_session,
|
||||
std::thread{
|
||||
do_session,
|
||||
std::move(socket),
|
||||
std::ref(ctx),
|
||||
doc_root)}.detach();
|
||||
doc_root}.detach();
|
||||
}
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
|
@ -210,7 +210,7 @@ fail(beast::error_code ec, char const* what)
|
||||
// Handles an HTTP server connection
|
||||
void
|
||||
do_session(
|
||||
tcp::socket& socket,
|
||||
tcp::socket socket,
|
||||
std::shared_ptr<std::string const> const& doc_root)
|
||||
{
|
||||
beast::error_code ec;
|
||||
@ -287,10 +287,10 @@ int main(int argc, char* argv[])
|
||||
acceptor.accept(socket);
|
||||
|
||||
// Launch the session, transferring ownership of the socket
|
||||
std::thread{std::bind(
|
||||
&do_session,
|
||||
std::thread{
|
||||
do_session,
|
||||
std::move(socket),
|
||||
doc_root)}.detach();
|
||||
doc_root}.detach();
|
||||
}
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
|
@ -80,7 +80,7 @@ setup_stream(websocket::stream<NextLayer>& ws)
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
void
|
||||
do_sync_session(websocket::stream<beast::tcp_stream>& ws)
|
||||
do_sync_session(websocket::stream<beast::tcp_stream> ws)
|
||||
{
|
||||
beast::error_code ec;
|
||||
|
||||
@ -129,10 +129,10 @@ do_sync_listen(
|
||||
if(ec)
|
||||
return fail(ec, "accept");
|
||||
|
||||
std::thread(std::bind(
|
||||
&do_sync_session,
|
||||
websocket::stream<beast::tcp_stream>(
|
||||
std::move(socket)))).detach();
|
||||
std::thread{
|
||||
do_sync_session,
|
||||
websocket::stream<beast::tcp_stream>(std::move(socket))
|
||||
}.detach();
|
||||
}
|
||||
}
|
||||
|
||||
@ -441,13 +441,11 @@ int main(int argc, char* argv[])
|
||||
net::io_context ioc{threads};
|
||||
|
||||
// Create sync port
|
||||
std::thread(beast::bind_front_handler(
|
||||
&do_sync_listen,
|
||||
std::thread{
|
||||
do_sync_listen,
|
||||
std::ref(ioc),
|
||||
tcp::endpoint{
|
||||
address,
|
||||
static_cast<unsigned short>(port + 0u)}
|
||||
)).detach();
|
||||
tcp::endpoint{address, static_cast<unsigned short>(port + 0u)}
|
||||
}.detach();
|
||||
|
||||
// Create async port
|
||||
std::make_shared<async_listener>(
|
||||
|
@ -123,10 +123,10 @@ int main(int argc, char* argv[])
|
||||
acceptor.accept(socket);
|
||||
|
||||
// Launch the session, transferring ownership of the socket
|
||||
std::thread(
|
||||
&do_session,
|
||||
std::thread{
|
||||
do_session,
|
||||
std::move(socket),
|
||||
std::ref(ctx)).detach();
|
||||
std::ref(ctx)}.detach();
|
||||
}
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
|
@ -108,9 +108,9 @@ int main(int argc, char* argv[])
|
||||
acceptor.accept(socket);
|
||||
|
||||
// Launch the session, transferring ownership of the socket
|
||||
std::thread(
|
||||
&do_session,
|
||||
std::move(socket)).detach();
|
||||
std::thread{
|
||||
do_session,
|
||||
std::move(socket)}.detach();
|
||||
}
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
|
Reference in New Issue
Block a user