diff --git a/CHANGELOG.md b/CHANGELOG.md index 5311cfd6..6aece344 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ Version 226: * Support -fno-exceptions +* make_strand is in net:: -------------------------------------------------------------------------------- diff --git a/doc/qbk/03_core/3_timeouts.qbk b/doc/qbk/03_core/3_timeouts.qbk index f31d546a..d3783be9 100644 --- a/doc/qbk/03_core/3_timeouts.qbk +++ b/doc/qbk/03_core/3_timeouts.qbk @@ -90,8 +90,8 @@ Alternatively, we can construct the stream from an executor: [code_core_3_timeouts_2] The function -[link beast.ref.boost__beast__make_strand `make_strand`] returns a strand -constructed from an execution context or executor. When a +[@boost:/doc/html/boost_asio/reference/make_strand.html `make_strand`] +returns a strand constructed from an execution context or executor. When a [@boost:/doc/html/boost_asio/reference/strand.html `net::strand`] is chosen for the stream's executor, all completion handlers which do not already have an associated executor will use the strand. This is both a diff --git a/doc/qbk/quickref.xml b/doc/qbk/quickref.xml index 3eaf71f7..843bef9f 100644 --- a/doc/qbk/quickref.xml +++ b/doc/qbk/quickref.xml @@ -74,7 +74,6 @@ generic_category get_lowest_layer  iequals - make_strand  to_static_string diff --git a/doc/qbk/release_notes.qbk b/doc/qbk/release_notes.qbk index 8a9d67c9..fc22e1fc 100644 --- a/doc/qbk/release_notes.qbk +++ b/doc/qbk/release_notes.qbk @@ -117,8 +117,6 @@ * Add `cdata()` to also return constant readable bytes * Eligible member functions are declared `noexcept` -* New `make_strand` - * ([issue 1345]) Better `flat_buffer`, `multi_buffer` diff --git a/example/advanced/server-flex/advanced_server_flex.cpp b/example/advanced/server-flex/advanced_server_flex.cpp index b6446e59..827cf9b2 100644 --- a/example/advanced/server-flex/advanced_server_flex.cpp +++ b/example/advanced/server-flex/advanced_server_flex.cpp @@ -874,7 +874,7 @@ public: std::shared_ptr const& doc_root) : ioc_(ioc) , ctx_(ctx) - , acceptor_(beast::make_strand(ioc)) + , acceptor_(net::make_strand(ioc)) , doc_root_(doc_root) { beast::error_code ec; @@ -927,7 +927,7 @@ public: { // The new connection gets its own strand acceptor_.async_accept( - beast::make_strand(ioc_), + net::make_strand(ioc_), beast::bind_front_handler( &listener::on_accept, shared_from_this())); diff --git a/example/advanced/server/advanced_server.cpp b/example/advanced/server/advanced_server.cpp index 11a4142e..c2733bc6 100644 --- a/example/advanced/server/advanced_server.cpp +++ b/example/advanced/server/advanced_server.cpp @@ -545,7 +545,7 @@ public: tcp::endpoint endpoint, std::shared_ptr const& doc_root) : ioc_(ioc) - , acceptor_(beast::make_strand(ioc)) + , acceptor_(net::make_strand(ioc)) , doc_root_(doc_root) { beast::error_code ec; @@ -598,7 +598,7 @@ public: { // The new connection gets its own strand acceptor_.async_accept( - beast::make_strand(ioc_), + net::make_strand(ioc_), beast::bind_front_handler( &listener::on_accept, shared_from_this())); diff --git a/example/http/client/async-ssl/http_client_async_ssl.cpp b/example/http/client/async-ssl/http_client_async_ssl.cpp index 345acab0..83d69c59 100644 --- a/example/http/client/async-ssl/http_client_async_ssl.cpp +++ b/example/http/client/async-ssl/http_client_async_ssl.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -54,8 +55,8 @@ public: // ensure that handlers do not execute concurrently. explicit session(net::io_context& ioc, ssl::context& ctx) - : resolver_(beast::make_strand(ioc)) - , stream_(beast::make_strand(ioc), ctx) + : resolver_(net::make_strand(ioc)) + , stream_(net::make_strand(ioc), ctx) { } diff --git a/example/http/client/async/http_client_async.cpp b/example/http/client/async/http_client_async.cpp index ead34154..f451df51 100644 --- a/example/http/client/async/http_client_async.cpp +++ b/example/http/client/async/http_client_async.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -50,8 +51,8 @@ public: // ensure that handlers do not execute concurrently. explicit session(net::io_context& ioc) - : resolver_(beast::make_strand(ioc)) - , stream_(beast::make_strand(ioc)) + : resolver_(net::make_strand(ioc)) + , stream_(net::make_strand(ioc)) { } diff --git a/example/http/client/crawl/http_crawl.cpp b/example/http/client/crawl/http_crawl.cpp index e5e9c99c..c303518d 100644 --- a/example/http/client/crawl/http_crawl.cpp +++ b/example/http/client/crawl/http_crawl.cpp @@ -164,8 +164,8 @@ public: crawl_report& report, net::io_context& ioc) : report_(report) - , resolver_(beast::make_strand(ioc)) - , stream_(beast::make_strand(ioc)) + , resolver_(net::make_strand(ioc)) + , stream_(net::make_strand(ioc)) { // Set up the common fields of the request req_.version(11); diff --git a/example/http/server/async-ssl/http_server_async_ssl.cpp b/example/http/server/async-ssl/http_server_async_ssl.cpp index 9908a8f2..14a1b06b 100644 --- a/example/http/server/async-ssl/http_server_async_ssl.cpp +++ b/example/http/server/async-ssl/http_server_async_ssl.cpp @@ -473,7 +473,7 @@ public: { // The new connection gets its own strand acceptor_.async_accept( - beast::make_strand(ioc_), + net::make_strand(ioc_), beast::bind_front_handler( &listener::on_accept, shared_from_this())); diff --git a/example/http/server/async/http_server_async.cpp b/example/http/server/async/http_server_async.cpp index a5044dc8..511eed98 100644 --- a/example/http/server/async/http_server_async.cpp +++ b/example/http/server/async/http_server_async.cpp @@ -362,7 +362,7 @@ public: tcp::endpoint endpoint, std::shared_ptr const& doc_root) : ioc_(ioc) - , acceptor_(beast::make_strand(ioc)) + , acceptor_(net::make_strand(ioc)) , doc_root_(doc_root) { beast::error_code ec; @@ -415,7 +415,7 @@ public: { // The new connection gets its own strand acceptor_.async_accept( - beast::make_strand(ioc_), + net::make_strand(ioc_), beast::bind_front_handler( &listener::on_accept, shared_from_this())); diff --git a/example/http/server/flex/http_server_flex.cpp b/example/http/server/flex/http_server_flex.cpp index c16637c6..8ddb4d00 100644 --- a/example/http/server/flex/http_server_flex.cpp +++ b/example/http/server/flex/http_server_flex.cpp @@ -570,7 +570,7 @@ public: std::shared_ptr const& doc_root) : ioc_(ioc) , ctx_(ctx) - , acceptor_(beast::make_strand(ioc)) + , acceptor_(net::make_strand(ioc)) , doc_root_(doc_root) { beast::error_code ec; @@ -623,7 +623,7 @@ public: { // The new connection gets its own strand acceptor_.async_accept( - beast::make_strand(ioc_), + net::make_strand(ioc_), beast::bind_front_handler( &listener::on_accept, shared_from_this())); diff --git a/example/http/server/stackless-ssl/http_server_stackless_ssl.cpp b/example/http/server/stackless-ssl/http_server_stackless_ssl.cpp index bc12df44..85b9a0c4 100644 --- a/example/http/server/stackless-ssl/http_server_stackless_ssl.cpp +++ b/example/http/server/stackless-ssl/http_server_stackless_ssl.cpp @@ -413,8 +413,8 @@ public: std::shared_ptr const& doc_root) : ioc_(ioc) , ctx_(ctx) - , acceptor_(beast::make_strand(ioc)) - , socket_(beast::make_strand(ioc)) + , acceptor_(net::make_strand(ioc)) + , socket_(net::make_strand(ioc)) , doc_root_(doc_root) { beast::error_code ec; @@ -490,7 +490,7 @@ public: } // Make sure each session gets its own strand - socket_ = tcp::socket(beast::make_strand(ioc_)); + socket_ = tcp::socket(net::make_strand(ioc_)); } } } diff --git a/example/http/server/stackless/http_server_stackless.cpp b/example/http/server/stackless/http_server_stackless.cpp index f544d7a1..934231ca 100644 --- a/example/http/server/stackless/http_server_stackless.cpp +++ b/example/http/server/stackless/http_server_stackless.cpp @@ -356,8 +356,8 @@ public: tcp::endpoint endpoint, std::shared_ptr const& doc_root) : ioc_(ioc) - , acceptor_(beast::make_strand(ioc)) - , socket_(beast::make_strand(ioc)) + , acceptor_(net::make_strand(ioc)) + , socket_(net::make_strand(ioc)) , doc_root_(doc_root) { beast::error_code ec; @@ -430,7 +430,7 @@ public: } // Make sure each session gets its own strand - socket_ = tcp::socket(beast::make_strand(ioc_)); + socket_ = tcp::socket(net::make_strand(ioc_)); } } } diff --git a/example/websocket/client/async-ssl/websocket_client_async_ssl.cpp b/example/websocket/client/async-ssl/websocket_client_async_ssl.cpp index 2d886c0d..6062c8d0 100644 --- a/example/websocket/client/async-ssl/websocket_client_async_ssl.cpp +++ b/example/websocket/client/async-ssl/websocket_client_async_ssl.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -55,8 +56,8 @@ public: // Resolver and socket require an io_context explicit session(net::io_context& ioc, ssl::context& ctx) - : resolver_(beast::make_strand(ioc)) - , ws_(beast::make_strand(ioc), ctx) + : resolver_(net::make_strand(ioc)) + , ws_(net::make_strand(ioc), ctx) { } diff --git a/example/websocket/client/async/websocket_client_async.cpp b/example/websocket/client/async/websocket_client_async.cpp index d5bf8ee0..15b127d3 100644 --- a/example/websocket/client/async/websocket_client_async.cpp +++ b/example/websocket/client/async/websocket_client_async.cpp @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -49,8 +50,8 @@ public: // Resolver and socket require an io_context explicit session(net::io_context& ioc) - : resolver_(beast::make_strand(ioc)) - , ws_(beast::make_strand(ioc)) + : resolver_(net::make_strand(ioc)) + , ws_(net::make_strand(ioc)) { } diff --git a/example/websocket/server/async-ssl/websocket_server_async_ssl.cpp b/example/websocket/server/async-ssl/websocket_server_async_ssl.cpp index 0678fde1..6d03e1af 100644 --- a/example/websocket/server/async-ssl/websocket_server_async_ssl.cpp +++ b/example/websocket/server/async-ssl/websocket_server_async_ssl.cpp @@ -183,7 +183,7 @@ public: tcp::endpoint endpoint) : ioc_(ioc) , ctx_(ctx) - , acceptor_(beast::make_strand(ioc)) + , acceptor_(net::make_strand(ioc)) { beast::error_code ec; @@ -235,7 +235,7 @@ public: { // The new connection gets its own strand acceptor_.async_accept( - beast::make_strand(ioc_), + net::make_strand(ioc_), beast::bind_front_handler( &listener::on_accept, shared_from_this())); diff --git a/example/websocket/server/async/websocket_server_async.cpp b/example/websocket/server/async/websocket_server_async.cpp index 5663561c..fb4825b4 100644 --- a/example/websocket/server/async/websocket_server_async.cpp +++ b/example/websocket/server/async/websocket_server_async.cpp @@ -206,7 +206,7 @@ public: { // The new connection gets its own strand acceptor_.async_accept( - beast::make_strand(ioc_), + net::make_strand(ioc_), beast::bind_front_handler( &listener::on_accept, shared_from_this())); diff --git a/example/websocket/server/chat-multi/listener.cpp b/example/websocket/server/chat-multi/listener.cpp index 93f8c486..8bbecb49 100644 --- a/example/websocket/server/chat-multi/listener.cpp +++ b/example/websocket/server/chat-multi/listener.cpp @@ -62,7 +62,7 @@ run() { // The new connection gets its own strand acceptor_.async_accept( - beast::make_strand(ioc_), + net::make_strand(ioc_), beast::bind_front_handler( &listener::on_accept, shared_from_this())); @@ -94,7 +94,7 @@ on_accept(beast::error_code ec, tcp::socket socket) // The new connection gets its own strand acceptor_.async_accept( - beast::make_strand(ioc_), + net::make_strand(ioc_), beast::bind_front_handler( &listener::on_accept, shared_from_this())); diff --git a/example/websocket/server/fast/websocket_server_fast.cpp b/example/websocket/server/fast/websocket_server_fast.cpp index 2e962137..146fabd3 100644 --- a/example/websocket/server/fast/websocket_server_fast.cpp +++ b/example/websocket/server/fast/websocket_server_fast.cpp @@ -249,7 +249,7 @@ public: net::io_context& ioc, tcp::endpoint endpoint) : ioc_(ioc) - , acceptor_(beast::make_strand(ioc)) + , acceptor_(net::make_strand(ioc)) { beast::error_code ec; @@ -301,7 +301,7 @@ public: { // The new connection gets its own strand acceptor_.async_accept( - beast::make_strand(ioc_), + net::make_strand(ioc_), beast::bind_front_handler( &async_listener::on_accept, shared_from_this())); diff --git a/example/websocket/server/stackless-ssl/websocket_server_stackless_ssl.cpp b/example/websocket/server/stackless-ssl/websocket_server_stackless_ssl.cpp index b8786dfe..d0b285f0 100644 --- a/example/websocket/server/stackless-ssl/websocket_server_stackless_ssl.cpp +++ b/example/websocket/server/stackless-ssl/websocket_server_stackless_ssl.cpp @@ -250,7 +250,7 @@ public: } // Make sure each session gets its own strand - socket_ = tcp::socket(beast::make_strand(ioc_)); + socket_ = tcp::socket(net::make_strand(ioc_)); } } } diff --git a/example/websocket/server/stackless/websocket_server_stackless.cpp b/example/websocket/server/stackless/websocket_server_stackless.cpp index 324b1097..d03a181c 100644 --- a/example/websocket/server/stackless/websocket_server_stackless.cpp +++ b/example/websocket/server/stackless/websocket_server_stackless.cpp @@ -151,8 +151,8 @@ public: net::io_context& ioc, tcp::endpoint endpoint) : ioc_(ioc) - , acceptor_(beast::make_strand(ioc)) - , socket_(beast::make_strand(ioc)) + , acceptor_(net::make_strand(ioc)) + , socket_(net::make_strand(ioc)) { beast::error_code ec; @@ -224,7 +224,7 @@ public: } // Make sure each session gets its own strand - socket_ = tcp::socket(beast::make_strand(ioc_)); + socket_ = tcp::socket(net::make_strand(ioc_)); } } } diff --git a/include/boost/beast/core.hpp b/include/boost/beast/core.hpp index 51c9988d..0fec18cf 100644 --- a/include/boost/beast/core.hpp +++ b/include/boost/beast/core.hpp @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include diff --git a/include/boost/beast/core/make_strand.hpp b/include/boost/beast/core/make_strand.hpp deleted file mode 100644 index 6c29309b..00000000 --- a/include/boost/beast/core/make_strand.hpp +++ /dev/null @@ -1,60 +0,0 @@ -// -// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// Official repository: https://github.com/boostorg/beast -// - -#ifndef BOOST_BEAST_MAKE_STRAND_HPP -#define BOOST_BEAST_MAKE_STRAND_HPP - -#include -#include -#include -#include -#include - -namespace boost { -namespace beast { - -/** Return a strand usable with the specified execution context. -*/ -#if BOOST_BEAST_DOXYGEN -template -__see_below__ -#else -template::value && - std::is_convertible< - ExecutionContext&, - net::execution_context&>::value>::type -> -net::strand> -#endif -make_strand(ExecutionContext& context) -{ - return net::strand>{context.get_executor()}; -} - -/** Return a strand usable with the specified executor. -*/ -template::type -#endif -> -net::strand -make_strand(Executor const& ex) -{ - return net::strand{ex}; -} - -} // beast -} // boost - -#endif diff --git a/test/beast/core/CMakeLists.txt b/test/beast/core/CMakeLists.txt index 0ac0c268..bf0dbd01 100644 --- a/test/beast/core/CMakeLists.txt +++ b/test/beast/core/CMakeLists.txt @@ -57,7 +57,6 @@ add_executable (tests-beast-core flat_stream.cpp handler_ptr.cpp make_printable.cpp - make_strand.cpp multi_buffer.cpp ostream.cpp rate_policy.cpp diff --git a/test/beast/core/Jamfile b/test/beast/core/Jamfile index 3dbc7285..f3175efd 100644 --- a/test/beast/core/Jamfile +++ b/test/beast/core/Jamfile @@ -45,7 +45,6 @@ local SOURCES = flat_stream.cpp handler_ptr.cpp make_printable.cpp - make_strand.cpp multi_buffer.cpp ostream.cpp rate_policy.cpp diff --git a/test/beast/core/_detail_get_io_context.cpp b/test/beast/core/_detail_get_io_context.cpp index cb7e543c..1ee977fe 100644 --- a/test/beast/core/_detail_get_io_context.cpp +++ b/test/beast/core/_detail_get_io_context.cpp @@ -8,7 +8,6 @@ // #include -#include #include #include #include @@ -32,7 +31,7 @@ public: BEAST_EXPECT(get_io_context(none{}) == nullptr); BEAST_EXPECT(get_io_context(ioc) == &ioc); BEAST_EXPECT(get_io_context(ioc.get_executor()) == &ioc); - BEAST_EXPECT(get_io_context(make_strand(ioc)) == &ioc); + BEAST_EXPECT(get_io_context(net::make_strand(ioc)) == &ioc); BEAST_EXPECT(get_io_context(net::executor(ioc.get_executor())) == &ioc); #if 0 // VFALCO FIXME diff --git a/test/beast/core/make_strand.cpp b/test/beast/core/make_strand.cpp index 1c226858..b356c8eb 100644 --- a/test/beast/core/make_strand.cpp +++ b/test/beast/core/make_strand.cpp @@ -8,7 +8,7 @@ // // Test that header file is self-contained. -#include +#include #include #include @@ -24,15 +24,15 @@ public: testFunction() { net::io_context ioc; - make_strand(ioc); - make_strand(ioc.get_executor()); - make_strand(make_strand(ioc)); + net::make_strand(ioc); + net::make_strand(ioc.get_executor()); + net::make_strand(net::make_strand(ioc)); net::executor ex(ioc.get_executor()); - make_strand(ex); + net::make_strand(ex); // this *should-not* compile - //make_strand(ex.context()); + //net::make_strand(ex.context()); } void @@ -43,7 +43,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(beast,core,make_strand); +BEAST_DEFINE_TESTSUITE(beast,core,net::make_strand); } // beast } // boost diff --git a/test/beast/websocket/stream.cpp b/test/beast/websocket/stream.cpp index 7471320f..ab6aea1c 100644 --- a/test/beast/websocket/stream.cpp +++ b/test/beast/websocket/stream.cpp @@ -10,7 +10,6 @@ // Test that header file is self-contained. #include -#include #include #include @@ -158,7 +157,7 @@ public: { net::io_context ioc; { - websocket::stream ws{make_strand(ioc)}; + websocket::stream ws{net::make_strand(ioc)}; } { websocket::stream ws(ioc); diff --git a/test/doc/core_3_timeouts.cpp b/test/doc/core_3_timeouts.cpp index 3995fc9c..cbb84c64 100644 --- a/test/doc/core_3_timeouts.cpp +++ b/test/doc/core_3_timeouts.cpp @@ -69,7 +69,7 @@ core_3_timeouts_snippets() //[code_core_3_timeouts_3 // The strand will be used to invoke all completion handlers - tcp_stream stream(make_strand(ioc)); + tcp_stream stream(net::make_strand(ioc)); //] @@ -111,7 +111,7 @@ core_3_timeouts_snippets() // We construct the acceptor to use a new strand, and listen // on the loopback address with an operating-system assigned port. - net::ip::tcp::acceptor acceptor(make_strand(ioc)); + net::ip::tcp::acceptor acceptor(net::make_strand(ioc)); acceptor.bind(net::ip::tcp::endpoint(net::ip::make_address_v4("127.0.0.1"), 0)); acceptor.listen(0); @@ -120,7 +120,7 @@ core_3_timeouts_snippets() // connected to the peer. The socket will have its own executor, // which in the call below is a new strand for the I/O context. - net::ip::tcp::socket s = acceptor.accept(make_strand(ioc)); + net::ip::tcp::socket s = acceptor.accept(net::make_strand(ioc)); // Construct a new tcp_stream from the connected socket. // The stream will use the strand created when the connection diff --git a/test/doc/websocket.cpp b/test/doc/websocket.cpp index 133e3a85..9911417e 100644 --- a/test/doc/websocket.cpp +++ b/test/doc/websocket.cpp @@ -47,7 +47,7 @@ snippets() // The `tcp_stream` will be constructed with a new // strand which uses the specified I/O context. - stream ws(make_strand(ioc)); + stream ws(net::make_strand(ioc)); //] } @@ -76,7 +76,7 @@ snippets() //[code_websocket_5f // The WebSocket stream will use SSL and a new strand - stream> wss(make_strand(ioc), ctx); + stream> wss(net::make_strand(ioc), ctx); //] diff --git a/test/doc/websocket_1_connecting.cpp b/test/doc/websocket_1_connecting.cpp index fbf35a64..5e3c82cc 100644 --- a/test/doc/websocket_1_connecting.cpp +++ b/test/doc/websocket_1_connecting.cpp @@ -58,7 +58,7 @@ snippets() //[code_websocket_1_3 // The stream will use the strand for invoking all completion handlers - stream ws(make_strand(ioc)); + stream ws(net::make_strand(ioc)); // This overload of accept uses the socket provided for the new connection. // The function `tcp_stream::socket` provides access to the low-level socket