forked from boostorg/beast
read_message_max is a member of stream (API Change):
fix #446 * The read_message_max option struct is removed. Actions Required: * Change call sites which use read_message_max with set_option to call stream::read_message_max instead.
This commit is contained in:
@@ -124,41 +124,6 @@ struct ping_callback
|
||||
};
|
||||
#endif
|
||||
|
||||
/** Maximum incoming message size option.
|
||||
|
||||
Sets the largest permissible incoming message size. Message
|
||||
frame fields indicating a size that would bring the total
|
||||
message size over this limit will cause a protocol failure.
|
||||
|
||||
The default setting is 16 megabytes. A value of zero indicates
|
||||
a limit of the maximum value of a `std::uint64_t`.
|
||||
|
||||
@note Objects of this type are used with
|
||||
@ref beast::websocket::stream::set_option.
|
||||
|
||||
@par Example
|
||||
Setting the maximum read message size.
|
||||
@code
|
||||
...
|
||||
websocket::stream<ip::tcp::socket> ws(ios);
|
||||
ws.set_option(read_message_max{65536});
|
||||
@endcode
|
||||
*/
|
||||
#if BEAST_DOXYGEN
|
||||
using read_message_max = implementation_defined;
|
||||
#else
|
||||
struct read_message_max
|
||||
{
|
||||
std::size_t value;
|
||||
|
||||
explicit
|
||||
read_message_max(std::size_t n)
|
||||
: value(n)
|
||||
{
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
/** Write buffer size option.
|
||||
|
||||
Sets the size of the write buffer used by the implementation to
|
||||
|
||||
@@ -263,13 +263,6 @@ public:
|
||||
ping_cb_ = std::move(o.value);
|
||||
}
|
||||
|
||||
/// Set the maximum incoming message size allowed
|
||||
void
|
||||
set_option(read_message_max const& o)
|
||||
{
|
||||
rd_msg_max_ = o.value;
|
||||
}
|
||||
|
||||
/// Set the size of the write buffer
|
||||
void
|
||||
set_option(write_buffer_size const& o)
|
||||
@@ -377,6 +370,36 @@ public:
|
||||
return rd_buf_size_;
|
||||
}
|
||||
|
||||
/** Set the maximum incoming message size option.
|
||||
|
||||
Sets the largest permissible incoming message size. Message
|
||||
frame fields indicating a size that would bring the total
|
||||
message size over this limit will cause a protocol failure.
|
||||
|
||||
The default setting is 16 megabytes. A value of zero indicates
|
||||
a limit of the maximum value of a `std::uint64_t`.
|
||||
|
||||
@par Example
|
||||
Setting the maximum read message size.
|
||||
@code
|
||||
ws.read_message_max(65536);
|
||||
@endcode
|
||||
|
||||
@param n The limit on the size of incoming messages.
|
||||
*/
|
||||
void
|
||||
read_message_max(std::size_t n)
|
||||
{
|
||||
rd_msg_max_ = n;
|
||||
}
|
||||
|
||||
/// Returns the maximum incoming message size setting.
|
||||
std::size_t
|
||||
read_message_max() const
|
||||
{
|
||||
return rd_msg_max_;
|
||||
}
|
||||
|
||||
/** Returns the close reason received from the peer.
|
||||
|
||||
This is only valid after a read completes with error::closed.
|
||||
|
||||
Reference in New Issue
Block a user