Replace uses of net::spawn with asio::spawn

`asio::spawn` is an extension, which is not part of
the Networking TS, so the `net` alias is not appropriate in this case.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
This commit is contained in:
Damian Jarek
2019-06-16 23:56:06 +02:00
parent f10dc38ae6
commit 8d5bd286d7
13 changed files with 20 additions and 19 deletions

View File

@@ -11,6 +11,7 @@ Version 259:
* Fix coverage collection in AzP CI * Fix coverage collection in AzP CI
* Improve performance of `http::string_to_verb` * Improve performance of `http::string_to_verb`
* Replace uses of `net::coroutine` with `asio::coroutine` * Replace uses of `net::coroutine` with `asio::coroutine`
* Replace uses of `net::spawn` with `asio::spawn`
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View File

@@ -290,7 +290,7 @@ in place of the completion handler. The same `async_write` function overload
can work with a can work with a
[@https://en.wikipedia.org/wiki/Fiber_(computer_science) ['fiber]] [@https://en.wikipedia.org/wiki/Fiber_(computer_science) ['fiber]]
launched with launched with
[@boost:/doc/html/boost_asio/reference/spawn/overload1.html `net::spawn`]: [@boost:/doc/html/boost_asio/reference/spawn/overload1.html `asio::spawn`]:
[code_core_1_refresher_5s] [code_core_1_refresher_5s]

View File

@@ -162,7 +162,7 @@ int main(int argc, char** argv)
ctx.set_verify_mode(ssl::verify_peer); ctx.set_verify_mode(ssl::verify_peer);
// Launch the asynchronous operation // Launch the asynchronous operation
net::spawn(ioc, std::bind( boost::asio::spawn(ioc, std::bind(
&do_session, &do_session,
std::string(host), std::string(host),
std::string(port), std::string(port),

View File

@@ -127,7 +127,7 @@ int main(int argc, char** argv)
net::io_context ioc; net::io_context ioc;
// Launch the asynchronous operation // Launch the asynchronous operation
net::spawn(ioc, std::bind( boost::asio::spawn(ioc, std::bind(
&do_session, &do_session,
std::string(host), std::string(host),
std::string(port), std::string(port),

View File

@@ -371,7 +371,7 @@ do_listen(
if(ec) if(ec)
fail(ec, "accept"); fail(ec, "accept");
else else
net::spawn( boost::asio::spawn(
acceptor.get_executor(), acceptor.get_executor(),
std::bind( std::bind(
&do_session, &do_session,
@@ -408,7 +408,7 @@ int main(int argc, char* argv[])
load_server_certificate(ctx); load_server_certificate(ctx);
// Spawn a listening port // Spawn a listening port
net::spawn(ioc, boost::asio::spawn(ioc,
std::bind( std::bind(
&do_listen, &do_listen,
std::ref(ioc), std::ref(ioc),

View File

@@ -334,7 +334,7 @@ do_listen(
if(ec) if(ec)
fail(ec, "accept"); fail(ec, "accept");
else else
net::spawn( boost::asio::spawn(
acceptor.get_executor(), acceptor.get_executor(),
std::bind( std::bind(
&do_session, &do_session,
@@ -364,7 +364,7 @@ int main(int argc, char* argv[])
net::io_context ioc{threads}; net::io_context ioc{threads};
// Spawn a listening port // Spawn a listening port
net::spawn(ioc, boost::asio::spawn(ioc,
std::bind( std::bind(
&do_listen, &do_listen,
std::ref(ioc), std::ref(ioc),

View File

@@ -153,7 +153,7 @@ int main(int argc, char** argv)
load_root_certificates(ctx); load_root_certificates(ctx);
// Launch the asynchronous operation // Launch the asynchronous operation
net::spawn(ioc, std::bind( boost::asio::spawn(ioc, std::bind(
&do_session, &do_session,
std::string(host), std::string(host),
std::string(port), std::string(port),

View File

@@ -132,7 +132,7 @@ int main(int argc, char** argv)
net::io_context ioc; net::io_context ioc;
// Launch the asynchronous operation // Launch the asynchronous operation
net::spawn(ioc, std::bind( boost::asio::spawn(ioc, std::bind(
&do_session, &do_session,
std::string(host), std::string(host),
std::string(port), std::string(port),

View File

@@ -148,7 +148,7 @@ do_listen(
if(ec) if(ec)
fail(ec, "accept"); fail(ec, "accept");
else else
net::spawn( boost::asio::spawn(
acceptor.get_executor(), acceptor.get_executor(),
std::bind( std::bind(
&do_session, &do_session,
@@ -183,7 +183,7 @@ int main(int argc, char* argv[])
load_server_certificate(ctx); load_server_certificate(ctx);
// Spawn a listening port // Spawn a listening port
net::spawn(ioc, boost::asio::spawn(ioc,
std::bind( std::bind(
&do_listen, &do_listen,
std::ref(ioc), std::ref(ioc),

View File

@@ -129,7 +129,7 @@ do_listen(
if(ec) if(ec)
fail(ec, "accept"); fail(ec, "accept");
else else
net::spawn( boost::asio::spawn(
acceptor.get_executor(), acceptor.get_executor(),
std::bind( std::bind(
&do_session, &do_session,
@@ -158,7 +158,7 @@ int main(int argc, char* argv[])
net::io_context ioc(threads); net::io_context ioc(threads);
// Spawn a listening port // Spawn a listening port
net::spawn(ioc, boost::asio::spawn(ioc,
std::bind( std::bind(
&do_listen, &do_listen,
std::ref(ioc), std::ref(ioc),

View File

@@ -100,7 +100,7 @@ do_sync_session(websocket::stream<beast::tcp_stream>& ws)
for(;;) for(;;)
{ {
beast::flat_buffer buffer; beast::flat_buffer buffer;
ws.read(buffer, ec); ws.read(buffer, ec);
if(ec == websocket::error::closed) if(ec == websocket::error::closed)
break; break;
@@ -405,7 +405,7 @@ do_coro_listen(
continue; continue;
} }
net::spawn( boost::asio::spawn(
acceptor.get_executor(), acceptor.get_executor(),
std::bind( std::bind(
&do_coro_session, &do_coro_session,
@@ -456,7 +456,7 @@ int main(int argc, char* argv[])
static_cast<unsigned short>(port + 1u)})->run(); static_cast<unsigned short>(port + 1u)})->run();
// Create coro port // Create coro port
net::spawn(ioc, boost::asio::spawn(ioc,
std::bind( std::bind(
&do_coro_listen, &do_coro_listen,
std::ref(ioc), std::ref(ioc),

View File

@@ -73,7 +73,7 @@ snippets()
} }
{ {
//[code_core_1_refresher_5s //[code_core_1_refresher_5s
net::spawn( asio::spawn(
[&sock](net::yield_context yield) [&sock](net::yield_context yield)
{ {
std::size_t bytes_transferred = net::async_write(sock, std::size_t bytes_transferred = net::async_write(sock,
@@ -375,7 +375,7 @@ async_write(
>::return_type >::return_type
{ {
//[code_core_1_refresher_10 //[code_core_1_refresher_10
return net::async_initiate< return net::async_initiate<
CompletionToken, CompletionToken,
void(error_code, std::size_t)>( void(error_code, std::size_t)>(

View File

@@ -120,7 +120,7 @@ void
enable_yield_to:: enable_yield_to::
spawn(F0&& f, FN&&... fn) spawn(F0&& f, FN&&... fn)
{ {
net::spawn(ioc_, asio::spawn(ioc_,
[&](yield_context yield) [&](yield_context yield)
{ {
f(yield); f(yield);