mirror of
https://github.com/boostorg/beast.git
synced 2025-07-30 21:07:26 +02:00
stream_base::timeout::suggested is a nested function
This commit is contained in:
@ -1,3 +1,9 @@
|
||||
Version 222:
|
||||
|
||||
* stream_base::timeout::suggested is a nested function
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Version 221:
|
||||
|
||||
* Rename to async_base, stable_async_base
|
||||
|
@ -46,15 +46,15 @@ These stream members are used to write websocket messages:
|
||||
[[Function][Description]]
|
||||
[
|
||||
[
|
||||
[link beast.ref.boost__beast__websocket__stream.write `write`],
|
||||
[link beast.ref.boost__beast__websocket__stream.write.overload2 `write`],
|
||||
[link beast.ref.boost__beast__websocket__stream.async_write `async_write`]
|
||||
][
|
||||
Send a buffer sequence as a complete message.
|
||||
]
|
||||
][
|
||||
[
|
||||
[link beast.ref.boost__beast__websocket__stream.write_some `write_some`],
|
||||
[link beast.ref.boost__beast__websocket__stream.async_write `async_write_some`]
|
||||
[link beast.ref.boost__beast__websocket__stream.write_some.overload2 `write_some`],
|
||||
[link beast.ref.boost__beast__websocket__stream.async_write_some `async_write_some`]
|
||||
][
|
||||
Send a buffer sequence as part of a message.
|
||||
]
|
||||
@ -72,7 +72,7 @@ The same message could be sent in two or more frames thusly.
|
||||
[[Function][Description]]
|
||||
[
|
||||
[
|
||||
[link beast.ref.boost__beast__websocket__stream.read `read`],
|
||||
[link beast.ref.boost__beast__websocket__stream.read.overload2 `read`],
|
||||
[link beast.ref.boost__beast__websocket__stream.async_read `async_read`]
|
||||
][
|
||||
Read a complete message into a __DynamicBuffer__.
|
||||
@ -80,14 +80,14 @@ The same message could be sent in two or more frames thusly.
|
||||
][
|
||||
[
|
||||
[link beast.ref.boost__beast__websocket__stream.read_some.overload2 `read_some`],
|
||||
[link beast.ref.boost__beast__websocket__stream.async_read.overload1 `async_read_some`]
|
||||
[link beast.ref.boost__beast__websocket__stream.async_read_some.overload1 `async_read_some`]
|
||||
][
|
||||
Read part of a message into a __DynamicBuffer__.
|
||||
]
|
||||
][
|
||||
[
|
||||
[link beast.ref.boost__beast__websocket__stream.read_some.overload4 `read_some`],
|
||||
[link beast.ref.boost__beast__websocket__stream.async_read.overload2 `async_read_some`]
|
||||
[link beast.ref.boost__beast__websocket__stream.async_read_some.overload2 `async_read_some`]
|
||||
][
|
||||
Read part of a message into a __MutableBufferSequence__.
|
||||
]
|
||||
@ -117,6 +117,6 @@ message ahead of time:
|
||||
For these cases, the partial data oriented interface may be used. This
|
||||
example reads and echoes a complete message using this interface:
|
||||
|
||||
[ws_snippet_16]
|
||||
[code_websocket_4_3]
|
||||
|
||||
[endsect]
|
||||
|
@ -7,8 +7,42 @@
|
||||
Official repository: https://github.com/boostorg/beast
|
||||
]
|
||||
|
||||
[section Timeouts __new__]
|
||||
|
||||
[/-----------------------------------------------------------------------------]
|
||||
|
||||
[section Timeouts __new__]
|
||||
|
||||
While
|
||||
[link beast.ref.boost__beast__basic_stream `basic_stream`] and
|
||||
[link beast.ref.boost__beast__basic_stream `tcp_stream`] support timeouts on
|
||||
general logical operations, the websocket stream has a more sophisticated timeout
|
||||
mechanism built-in which may be enabled and configured. The timeout features
|
||||
of the TCP or basic stream should not be used when working with a websocket
|
||||
stream. The interface to these timeout features is show in this table.
|
||||
|
||||
[table WebSocket Timeout Interface
|
||||
[[Name][Description]]
|
||||
[[
|
||||
[link beast.ref.boost__beast__websocket__stream_base__timeout `stream_base::timeout`]
|
||||
][
|
||||
This represents configured timeout settings for a websocket stream.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.boost__beast__websocket__stream_base__timeout `stream_base::timeout`]
|
||||
][
|
||||
This is the type of the object passed to the decorator to
|
||||
represent HTTP Upgrade response.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.boost__beast__websocket__stream_base__decorator `stream_base::decorator`]
|
||||
][
|
||||
Objects of this type are used to hold a decorator to be
|
||||
set on the stream using `set_option`.
|
||||
]]
|
||||
[[
|
||||
[link beast.ref.boost__beast__websocket__stream.set_option `stream::set_option`]
|
||||
][
|
||||
This function is used to set a `stream_base::decorator` on the stream.
|
||||
]]
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
@ -138,7 +138,6 @@
|
||||
[import ../../test/doc/exemplars.cpp]
|
||||
[import ../../test/doc/core_snippets.cpp]
|
||||
[import ../../test/doc/http_snippets.cpp]
|
||||
[import ../../test/doc/websocket_snippets.cpp]
|
||||
|
||||
[import ../../test/doc/core_1_refresher.cpp]
|
||||
[import ../../test/doc/core_3_timeouts.cpp]
|
||||
|
@ -303,7 +303,6 @@
|
||||
<bridgehead renderas="sect3">Options</bridgehead>
|
||||
<simplelist type="vert" columns="1">
|
||||
<member><link linkend="beast.ref.boost__beast__websocket__permessage_deflate">permessage_deflate</link></member>
|
||||
<member><link linkend="beast.ref.boost__beast__websocket__stream_base.suggested_settings">suggested_settings</link> <emphasis role="green">★</emphasis></member>
|
||||
<member><link linkend="beast.ref.boost__beast__websocket__stream_base__decorator">decorator</link> <emphasis role="green">★</emphasis></member>
|
||||
<member><link linkend="beast.ref.boost__beast__websocket__stream_base__timeout">timeout</link> <emphasis role="green">★</emphasis></member>
|
||||
</simplelist>
|
||||
|
@ -267,7 +267,7 @@ public:
|
||||
{
|
||||
// Set suggested timeout settings for the websocket
|
||||
derived().ws().set_option(
|
||||
websocket::stream_base::suggested_settings(
|
||||
websocket::stream_base::timeout::suggested(
|
||||
beast::role_type::server));
|
||||
|
||||
// Set a decorator to change the Server of the handshake
|
||||
|
@ -237,7 +237,7 @@ public:
|
||||
{
|
||||
// Set suggested timeout settings for the websocket
|
||||
ws_.set_option(
|
||||
websocket::stream_base::suggested_settings(
|
||||
websocket::stream_base::timeout::suggested(
|
||||
beast::role_type::server));
|
||||
|
||||
// Set a decorator to change the Server of the handshake
|
||||
|
@ -128,7 +128,7 @@ public:
|
||||
|
||||
// Set suggested timeout settings for the websocket
|
||||
ws_.set_option(
|
||||
websocket::stream_base::suggested_settings(
|
||||
websocket::stream_base::timeout::suggested(
|
||||
beast::role_type::client));
|
||||
|
||||
// Set a decorator to change the User-Agent of the handshake
|
||||
|
@ -105,7 +105,7 @@ public:
|
||||
|
||||
// Set suggested timeout settings for the websocket
|
||||
ws_.set_option(
|
||||
websocket::stream_base::suggested_settings(
|
||||
websocket::stream_base::timeout::suggested(
|
||||
beast::role_type::client));
|
||||
|
||||
// Set a decorator to change the User-Agent of the handshake
|
||||
|
@ -94,7 +94,7 @@ do_session(
|
||||
|
||||
// Set suggested timeout settings for the websocket
|
||||
ws.set_option(
|
||||
websocket::stream_base::suggested_settings(
|
||||
websocket::stream_base::timeout::suggested(
|
||||
beast::role_type::client));
|
||||
|
||||
// Perform the websocket handshake
|
||||
|
@ -70,7 +70,7 @@ do_session(
|
||||
|
||||
// Set suggested timeout settings for the websocket
|
||||
ws.set_option(
|
||||
websocket::stream_base::suggested_settings(
|
||||
websocket::stream_base::timeout::suggested(
|
||||
beast::role_type::client));
|
||||
|
||||
// Set a decorator to change the User-Agent of the handshake
|
||||
|
@ -86,7 +86,7 @@ public:
|
||||
|
||||
// Set suggested timeout settings for the websocket
|
||||
ws_.set_option(
|
||||
websocket::stream_base::suggested_settings(
|
||||
websocket::stream_base::timeout::suggested(
|
||||
beast::role_type::server));
|
||||
|
||||
// Set a decorator to change the Server of the handshake
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
{
|
||||
// Set suggested timeout settings for the websocket
|
||||
ws_.set_option(
|
||||
websocket::stream_base::suggested_settings(
|
||||
websocket::stream_base::timeout::suggested(
|
||||
beast::role_type::server));
|
||||
|
||||
// Set a decorator to change the Server of the handshake
|
||||
|
@ -63,7 +63,7 @@ run(http::request<Body, http::basic_fields<Allocator>> req)
|
||||
{
|
||||
// Set suggested timeout settings for the websocket
|
||||
ws_.set_option(
|
||||
websocket::stream_base::suggested_settings(
|
||||
websocket::stream_base::timeout::suggested(
|
||||
beast::role_type::server));
|
||||
|
||||
// Set a decorator to change the Server of the handshake
|
||||
|
@ -68,7 +68,7 @@ do_session(
|
||||
|
||||
// Set suggested timeout settings for the websocket
|
||||
ws.set_option(
|
||||
websocket::stream_base::suggested_settings(
|
||||
websocket::stream_base::timeout::suggested(
|
||||
beast::role_type::server));
|
||||
|
||||
// Set a decorator to change the Server of the handshake
|
||||
|
@ -50,7 +50,7 @@ do_session(
|
||||
|
||||
// Set suggested timeout settings for the websocket
|
||||
ws.set_option(
|
||||
websocket::stream_base::suggested_settings(
|
||||
websocket::stream_base::timeout::suggested(
|
||||
beast::role_type::server));
|
||||
|
||||
// Set a decorator to change the Server of the handshake
|
||||
|
@ -158,7 +158,7 @@ public:
|
||||
{
|
||||
// Set suggested timeout settings for the websocket
|
||||
ws_.set_option(
|
||||
websocket::stream_base::suggested_settings(
|
||||
websocket::stream_base::timeout::suggested(
|
||||
beast::role_type::server));
|
||||
|
||||
// Set a decorator to change the Server of the handshake
|
||||
@ -338,7 +338,7 @@ do_coro_session(
|
||||
|
||||
// Set suggested timeout settings for the websocket
|
||||
ws.set_option(
|
||||
websocket::stream_base::suggested_settings(
|
||||
websocket::stream_base::timeout::suggested(
|
||||
beast::role_type::server));
|
||||
|
||||
// Set a decorator to change the Server of the handshake
|
||||
|
@ -98,7 +98,7 @@ public:
|
||||
|
||||
// Set suggested timeout settings for the websocket
|
||||
ws_.set_option(
|
||||
websocket::stream_base::suggested_settings(
|
||||
websocket::stream_base::timeout::suggested(
|
||||
beast::role_type::server));
|
||||
|
||||
// Set a decorator to change the Server of the handshake
|
||||
|
@ -75,7 +75,7 @@ public:
|
||||
{
|
||||
// Set suggested timeout settings for the websocket
|
||||
ws_.set_option(
|
||||
websocket::stream_base::suggested_settings(
|
||||
websocket::stream_base::timeout::suggested(
|
||||
beast::role_type::server));
|
||||
|
||||
// Set a decorator to change the Server of the handshake
|
||||
|
@ -465,7 +465,7 @@ public:
|
||||
storage, the class @ref stable_async_base is provided which offers
|
||||
additional functionality:
|
||||
|
||||
@li The free function @ref allocate_stable may be used to allocate
|
||||
@li The free function @ref beast::allocate_stable may be used to allocate
|
||||
one or more temporary objects associated with the composed operation.
|
||||
|
||||
@li Memory for stable temporary objects is allocated using the allocator
|
||||
@ -482,7 +482,7 @@ public:
|
||||
assist authoring an asynchronous initiating function, by providing all of
|
||||
the boilerplate to manage the final completion handler in a way that maintains
|
||||
the allocator and executor associations. Furthermore, the operation shown
|
||||
allocates temporary memory using @ref allocate_stable for the timer and
|
||||
allocates temporary memory using @ref beast::allocate_stable for the timer and
|
||||
message, whose addresses must not change between intermediate operations:
|
||||
|
||||
@code
|
||||
@ -592,7 +592,7 @@ public:
|
||||
not default constructible, an instance of the type must be provided
|
||||
upon construction.
|
||||
|
||||
@see @ref allocate_stable, @ref async_base
|
||||
@see allocate_stable, async_base
|
||||
*/
|
||||
template<
|
||||
class Handler,
|
||||
|
@ -105,7 +105,6 @@ struct stream_base
|
||||
complete immediately the error @ref beast::error::timeout.
|
||||
*/
|
||||
bool keep_alive_pings;
|
||||
};
|
||||
|
||||
/** Construct timeout settings with suggested values for a role.
|
||||
|
||||
@ -125,7 +124,7 @@ struct stream_base
|
||||
*/
|
||||
static
|
||||
timeout
|
||||
suggested_settings(role_type role) noexcept
|
||||
suggested(role_type role) noexcept
|
||||
{
|
||||
timeout opt{};
|
||||
switch(role)
|
||||
@ -145,6 +144,8 @@ struct stream_base
|
||||
return opt;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
protected:
|
||||
enum class status
|
||||
{
|
||||
|
@ -45,11 +45,11 @@ public:
|
||||
|
||||
{
|
||||
ws.set_option(
|
||||
stream_base::suggested_settings(
|
||||
stream_base::timeout::suggested(
|
||||
role_type::client));
|
||||
|
||||
ws.set_option(
|
||||
stream_base::suggested_settings(
|
||||
stream_base::timeout::suggested(
|
||||
role_type::server));
|
||||
|
||||
ws.set_option({
|
||||
|
@ -88,7 +88,7 @@ snippets()
|
||||
//stream<tcp_stream> ws(ioc);
|
||||
|
||||
{
|
||||
//[code_websocket_7_1
|
||||
//[code_websocket_7_3
|
||||
|
||||
//]
|
||||
}
|
||||
|
Reference in New Issue
Block a user