From 79c777e77616984befaffc5d2ed07e553b816b2c Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Sat, 16 Feb 2019 18:35:22 -0800 Subject: [PATCH] Tidying and fixes --- doc/qbk/quickref.xml | 3 +++ include/boost/beast/_experimental/test/stream.hpp | 2 +- include/boost/beast/_experimental/test/tcp.hpp | 4 ++++ include/boost/beast/core/dynamic_buffer_ref.hpp | 2 +- include/boost/beast/http/basic_parser.hpp | 6 +++--- include/boost/beast/websocket/impl/stream_impl.hpp | 7 +++---- include/boost/beast/websocket/stream_base.hpp | 8 ++++---- 7 files changed, 19 insertions(+), 13 deletions(-) diff --git a/doc/qbk/quickref.xml b/doc/qbk/quickref.xml index 941c7255..6c1b8a8f 100644 --- a/doc/qbk/quickref.xml +++ b/doc/qbk/quickref.xml @@ -280,6 +280,7 @@ close_reason ping_data stream + stream_base reason_string Functions @@ -292,6 +293,8 @@ Options permessage_deflate + suggested_settings 🞲 + timeout 🞲 Constants diff --git a/include/boost/beast/_experimental/test/stream.hpp b/include/boost/beast/_experimental/test/stream.hpp index e9c1d40f..4a385f61 100644 --- a/include/boost/beast/_experimental/test/stream.hpp +++ b/include/boost/beast/_experimental/test/stream.hpp @@ -62,7 +62,7 @@ namespace test { To facilitate testing, these streams support some additional features: - @li The input area, represented by a @ref basic_flat_buffer, + @li The input area, represented by a @ref beast::basic_flat_buffer, may be directly accessed by the caller to inspect the contents before or after the remote endpoint writes data. This allows a unit test to verify that the received data matches. diff --git a/include/boost/beast/_experimental/test/tcp.hpp b/include/boost/beast/_experimental/test/tcp.hpp index ec4bb139..22173587 100644 --- a/include/boost/beast/_experimental/test/tcp.hpp +++ b/include/boost/beast/_experimental/test/tcp.hpp @@ -26,6 +26,8 @@ namespace test { I/O context, until one of the following conditions is true: @li The I/O context runs out of work. + + @param ioc The I/O context to run */ inline void @@ -44,6 +46,8 @@ run(net::io_context& ioc) @li No completions occur and the specified amount of time has elapsed. + @param ioc The I/O context to run + @param elapsed The maximum amount of time to run for. */ template diff --git a/include/boost/beast/core/dynamic_buffer_ref.hpp b/include/boost/beast/core/dynamic_buffer_ref.hpp index 7763e3c0..03b33e7a 100644 --- a/include/boost/beast/core/dynamic_buffer_ref.hpp +++ b/include/boost/beast/core/dynamic_buffer_ref.hpp @@ -110,7 +110,7 @@ public: @par Example This function reads a line of text from a stream into a - @ref basic_flat_buffer, using the net function `async_read_until`. + @ref beast::basic_flat_buffer, using the net function `async_read_until`. @code template std::size_t read_line (SyncReadStream& stream, flat_buffer& buffer) diff --git a/include/boost/beast/http/basic_parser.hpp b/include/boost/beast/http/basic_parser.hpp index 0f687ff5..280e0d2b 100644 --- a/include/boost/beast/http/basic_parser.hpp +++ b/include/boost/beast/http/basic_parser.hpp @@ -38,10 +38,10 @@ namespace http { fields. The parser is optimized for the case where the input buffer sequence consists of a single contiguous buffer. The - @ref basic_flat_buffer class is provided, which guarantees + @ref beast::basic_flat_buffer class is provided, which guarantees that the input sequence of the stream buffer will be represented by exactly one contiguous buffer. To ensure the optimum performance - of the parser, use @ref basic_flat_buffer with HTTP algorithms + of the parser, use @ref beast::basic_flat_buffer with HTTP algorithms such as @ref read, @ref read_some, @ref async_read, and @ref async_read_some. Alternatively, the caller may use custom techniques to ensure that the structured portion of the HTTP message (header or chunk header) @@ -511,7 +511,7 @@ public: @b ConstBufferSequence that represents the next chunk of message data. If the length of this buffer sequence is one, the implementation will not allocate additional memory. - The class @ref beast::flat_buffer is provided as one way to + The class @ref beast::basic_flat_buffer is provided as one way to meet this requirement @param ec Set to the error, if any occurred. diff --git a/include/boost/beast/websocket/impl/stream_impl.hpp b/include/boost/beast/websocket/impl/stream_impl.hpp index 52914f1b..ffebaf05 100644 --- a/include/boost/beast/websocket/impl/stream_impl.hpp +++ b/include/boost/beast/websocket/impl/stream_impl.hpp @@ -93,22 +93,21 @@ struct stream::impl_type saved_handler op_r_close; // paused close op (async read) bool secure_prng_ = true; - bool ec_delivered = false; bool timed_out = false; int idle_counter = 0; - // settings - timeout timeout_opt; - // template impl_type(Args&&... args) : stream(std::forward(args)...) , timer(stream.get_executor().context()) { + timeout_opt.handshake_timeout = none(); + timeout_opt.idle_timeout = none(); + timeout_opt.keep_alive_pings = false; } void diff --git a/include/boost/beast/websocket/stream_base.hpp b/include/boost/beast/websocket/stream_base.hpp index 26dba83b..7781a0f5 100644 --- a/include/boost/beast/websocket/stream_base.hpp +++ b/include/boost/beast/websocket/stream_base.hpp @@ -64,11 +64,11 @@ struct stream_base amount of time, the operation will be canceled and a timeout error delivered to the completion handler. */ - duration handshake_timeout = none(); + duration handshake_timeout; /** The time limit after which a connection is considered idle. */ - duration idle_timeout = none(); + duration idle_timeout; /** Automatic ping setting. @@ -86,7 +86,7 @@ struct stream_base An outstanding read operation must be pending, which will complete immediately the error @ref beast::error::timeout. */ - bool keep_alive_pings = false; + bool keep_alive_pings; }; /** Construct timeout settings with suggested values for a role. @@ -103,7 +103,7 @@ struct stream_base timeout suggested_settings(role_type role) noexcept { - timeout opt; + timeout opt{}; switch(role) { case role_type::client: