Tidy up a warning and test

This commit is contained in:
Vinnie Falco
2019-02-27 18:15:01 -08:00
parent ef5282ebcf
commit 974f34beab
2 changed files with 7 additions and 11 deletions

View File

@ -186,25 +186,21 @@ async_echo(
(*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
// the number of characters from the beginning of the buffer up to the
// newline, including the newline character. Otherwise it returns zero.
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
// iterators into a buffer sequence. Use the standard algorithm
// to look for the new line if it exists.
auto begin = net::buffers_iterator<const_buffers_type>::begin(buffers);
auto end = net::buffers_iterator<const_buffers_type>::end(buffers);
auto begin = net::buffers_iterator<
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');
if(result == end)

View File

@ -41,7 +41,7 @@ struct timer_test : unit_test::suite
ws2.set_option(stream_base::timeout{
stream_base::none(),
std::chrono::milliseconds(50),
std::chrono::milliseconds(100),
true});
flat_buffer b1;
flat_buffer b2;
@ -56,7 +56,7 @@ struct timer_test : unit_test::suite
net::error::operation_aborted));
ws2.async_read(b2, test::fail_handler(
net::error::operation_aborted));
test::run_for(ioc, std::chrono::milliseconds(100));
test::run_for(ioc, std::chrono::milliseconds(500));
BEAST_EXPECT(received);
}