mirror of
https://github.com/boostorg/beast.git
synced 2025-07-31 21:34:46 +02:00
Tidy up a warning and test
This commit is contained in:
@@ -186,25 +186,21 @@ async_echo(
|
|||||||
(*this)({}, 0, false);
|
(*this)({}, 0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is the type of buffer sequence used to represent the
|
|
||||||
// readable bytes of the dynamic buffer_. We declare a type alias
|
|
||||||
// to make the code easier to read.
|
|
||||||
|
|
||||||
using const_buffers_type = typename DynamicBuffer::const_buffers_type;
|
|
||||||
|
|
||||||
// If a newline is present in the buffer sequence, this function returns
|
// If a newline is present in the buffer sequence, this function returns
|
||||||
// the number of characters from the beginning of the buffer up to the
|
// the number of characters from the beginning of the buffer up to the
|
||||||
// newline, including the newline character. Otherwise it returns zero.
|
// newline, including the newline character. Otherwise it returns zero.
|
||||||
|
|
||||||
std::size_t
|
std::size_t
|
||||||
find_newline(const_buffers_type const& buffers)
|
find_newline(typename DynamicBuffer::const_buffers_type const& buffers)
|
||||||
{
|
{
|
||||||
// The `buffers_iterator` class template provides random-access
|
// The `buffers_iterator` class template provides random-access
|
||||||
// iterators into a buffer sequence. Use the standard algorithm
|
// iterators into a buffer sequence. Use the standard algorithm
|
||||||
// to look for the new line if it exists.
|
// to look for the new line if it exists.
|
||||||
|
|
||||||
auto begin = net::buffers_iterator<const_buffers_type>::begin(buffers);
|
auto begin = net::buffers_iterator<
|
||||||
auto end = net::buffers_iterator<const_buffers_type>::end(buffers);
|
typename DynamicBuffer::const_buffers_type>::begin(buffers);
|
||||||
|
auto end = net::buffers_iterator<
|
||||||
|
typename DynamicBuffer::const_buffers_type>::end(buffers);
|
||||||
auto result = std::find(begin, end, '\n');
|
auto result = std::find(begin, end, '\n');
|
||||||
|
|
||||||
if(result == end)
|
if(result == end)
|
||||||
|
@@ -41,7 +41,7 @@ struct timer_test : unit_test::suite
|
|||||||
|
|
||||||
ws2.set_option(stream_base::timeout{
|
ws2.set_option(stream_base::timeout{
|
||||||
stream_base::none(),
|
stream_base::none(),
|
||||||
std::chrono::milliseconds(50),
|
std::chrono::milliseconds(100),
|
||||||
true});
|
true});
|
||||||
flat_buffer b1;
|
flat_buffer b1;
|
||||||
flat_buffer b2;
|
flat_buffer b2;
|
||||||
@@ -56,7 +56,7 @@ struct timer_test : unit_test::suite
|
|||||||
net::error::operation_aborted));
|
net::error::operation_aborted));
|
||||||
ws2.async_read(b2, test::fail_handler(
|
ws2.async_read(b2, test::fail_handler(
|
||||||
net::error::operation_aborted));
|
net::error::operation_aborted));
|
||||||
test::run_for(ioc, std::chrono::milliseconds(100));
|
test::run_for(ioc, std::chrono::milliseconds(500));
|
||||||
BEAST_EXPECT(received);
|
BEAST_EXPECT(received);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user