mirror of
https://github.com/boostorg/beast.git
synced 2025-07-29 20:37:31 +02:00
Fix style errors
This commit is contained in:
@ -355,11 +355,12 @@ int main(int argc, char* argv[])
|
||||
// The io_context is required for all I/O
|
||||
net::io_context ioc;
|
||||
|
||||
// The work keeps io_context::run from returning
|
||||
auto work = net::any_io_executor(
|
||||
// Building a tracked executor ensures that the underlying context's
|
||||
// run() function will not return until the tracked executor is destroyed
|
||||
net::any_io_executor work =
|
||||
net::prefer(
|
||||
ioc.get_executor(),
|
||||
net::execution::outstanding_work.tracked));
|
||||
net::execution::outstanding_work.tracked);
|
||||
|
||||
// The report holds the aggregated statistics
|
||||
crawl_report report{ioc};
|
||||
|
@ -304,7 +304,8 @@ public:
|
||||
executor_type
|
||||
get_executor() const noexcept
|
||||
{
|
||||
return net::get_associated_executor(h_, wg1_.get_executor());
|
||||
return net::get_associated_executor(
|
||||
h_, wg1_.get_executor());
|
||||
}
|
||||
|
||||
/// Returns the handler associated with this object
|
||||
|
@ -67,19 +67,6 @@ public:
|
||||
h_, this->get());
|
||||
}
|
||||
|
||||
// The invocation hook is no longer defined because it customises behaviour
|
||||
// without forwarding to a user's hook.
|
||||
|
||||
#if 0
|
||||
template<class Function>
|
||||
void
|
||||
asio_handler_invoke(Function&& f,
|
||||
bind_default_executor_wrapper* p)
|
||||
{
|
||||
net::dispatch(p->get_executor(), std::move(f));
|
||||
}
|
||||
#endif
|
||||
|
||||
// The allocation hooks are still defined because they trivially forward to
|
||||
// user hooks. Forward here ensures that the user will get a compile error
|
||||
// if they build their code with BOOST_ASIO_NO_DEPRECATED.
|
||||
|
@ -33,13 +33,6 @@ public:
|
||||
BEAST_EXPECT(get_io_context(ioc.get_executor()) == &ioc);
|
||||
BEAST_EXPECT(get_io_context(net::make_strand(ioc)) == &ioc);
|
||||
BEAST_EXPECT(get_io_context(net::any_io_executor(ioc.get_executor())) == &ioc);
|
||||
#if 0
|
||||
// VFALCO FIXME
|
||||
BEAST_EXPECT(
|
||||
get_io_context(
|
||||
net::strand<net::any_io_executor>(
|
||||
net::any_io_executor(ioc.get_executor()))) == &ioc);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -40,18 +40,6 @@
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
|
||||
#if 0
|
||||
template class basic_stream<
|
||||
net::ip::tcp,
|
||||
net::any_io_executor,
|
||||
unlimited_rate_policy>;
|
||||
|
||||
template class basic_stream<
|
||||
net::ip::tcp,
|
||||
net::any_io_executor,
|
||||
simple_rate_policy>;
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
template<class Executor = net::io_context::executor_type>
|
||||
@ -376,20 +364,10 @@ public:
|
||||
basic_stream<tcp, strand> s1(ex);
|
||||
basic_stream<tcp, strand> s2(ex, tcp::v4());
|
||||
basic_stream<tcp, strand> s3(std::move(s1));
|
||||
#if 0
|
||||
s2.socket() = net::basic_stream_socket<
|
||||
tcp, strand>(ioc);
|
||||
#endif
|
||||
BEAST_EXPECT(s1.get_executor() == ex);
|
||||
BEAST_EXPECT(s2.get_executor() == ex);
|
||||
BEAST_EXPECT(s3.get_executor() == ex);
|
||||
|
||||
#if 0
|
||||
BEAST_EXPECT((! static_cast<
|
||||
basic_stream<tcp, strand> const&>(
|
||||
s2).socket().is_open()));
|
||||
#endif
|
||||
|
||||
test_sync_stream<
|
||||
basic_stream<
|
||||
tcp, strand>>();
|
||||
@ -399,20 +377,6 @@ public:
|
||||
tcp, strand>>();
|
||||
}
|
||||
|
||||
// construction from existing socket
|
||||
|
||||
#if 0
|
||||
{
|
||||
tcp::socket sock(ioc);
|
||||
basic_stream<tcp, executor> stream(std::move(sock));
|
||||
}
|
||||
|
||||
{
|
||||
tcp::socket sock(ioc);
|
||||
basic_stream<tcp, strand> stream(std::move(sock));
|
||||
}
|
||||
#endif
|
||||
|
||||
// layers
|
||||
|
||||
{
|
||||
|
@ -127,29 +127,39 @@ public:
|
||||
|
||||
#if defined(BOOST_ASIO_NO_TS_EXECUTORS)
|
||||
|
||||
net::execution_context& query(net::execution::context_t c) const noexcept
|
||||
net::execution_context&
|
||||
query(
|
||||
net::execution::context_t c) const noexcept
|
||||
{
|
||||
return net::query(ex_, c);
|
||||
}
|
||||
|
||||
net::execution::blocking_t query(net::execution::blocking_t) const noexcept
|
||||
net::execution::blocking_t
|
||||
query(
|
||||
net::execution::blocking_t) const noexcept
|
||||
{
|
||||
return blocking_;
|
||||
}
|
||||
|
||||
net::execution::outstanding_work_t query(net::execution::outstanding_work_t w) const noexcept
|
||||
net::execution::outstanding_work_t
|
||||
query(
|
||||
net::execution::outstanding_work_t w) const noexcept
|
||||
{
|
||||
return net::query(ex_, w);
|
||||
}
|
||||
|
||||
test_executor require(net::execution::blocking_t::possibly_t b) const
|
||||
test_executor
|
||||
require(
|
||||
net::execution::blocking_t::possibly_t b) const
|
||||
{
|
||||
test_executor new_ex(*this);
|
||||
new_ex.blocking_ = b;
|
||||
return new_ex;
|
||||
}
|
||||
|
||||
test_executor require(net::execution::blocking_t::never_t b) const
|
||||
test_executor
|
||||
require(
|
||||
net::execution::blocking_t::never_t b) const
|
||||
{
|
||||
test_executor new_ex(*this);
|
||||
new_ex.blocking_ = b;
|
||||
@ -193,18 +203,21 @@ public:
|
||||
return ex_.context();
|
||||
}
|
||||
|
||||
void on_work_started() const noexcept
|
||||
void
|
||||
on_work_started() const noexcept
|
||||
{
|
||||
ex_.on_work_started();
|
||||
}
|
||||
|
||||
void on_work_finished() const noexcept
|
||||
void
|
||||
on_work_finished() const noexcept
|
||||
{
|
||||
ex_.on_work_finished();
|
||||
}
|
||||
|
||||
template<class F, class Alloc>
|
||||
void dispatch(F&& f, Alloc const& a)
|
||||
void
|
||||
dispatch(F&& f, Alloc const& a)
|
||||
{
|
||||
s_.on_invoke();
|
||||
net::execution::execute(
|
||||
@ -217,7 +230,8 @@ public:
|
||||
}
|
||||
|
||||
template<class F, class Alloc>
|
||||
void post(F&& f, Alloc const& a)
|
||||
void
|
||||
post(F&& f, Alloc const& a)
|
||||
{
|
||||
// shouldn't be called since the enclosing
|
||||
// networking wrapper only uses dispatch
|
||||
@ -225,7 +239,8 @@ public:
|
||||
}
|
||||
|
||||
template<class F, class Alloc>
|
||||
void defer(F&& f, Alloc const& a)
|
||||
void
|
||||
defer(F&& f, Alloc const& a)
|
||||
{
|
||||
// shouldn't be called since the enclosing
|
||||
// networking wrapper only uses dispatch
|
||||
@ -235,21 +250,6 @@ public:
|
||||
};
|
||||
|
||||
#if defined(BOOST_ASIO_NO_TS_EXECUTORS)
|
||||
using F = net::execution::invocable_archetype;
|
||||
using T = test_executor;
|
||||
|
||||
BOOST_STATIC_ASSERT(
|
||||
conditional<true, true_type,
|
||||
typename std::result_of<typename std::decay<F>::type&()>::type
|
||||
>::type::value);
|
||||
|
||||
BOOST_STATIC_ASSERT(std::is_constructible<typename std::decay<F>::type, F>::value);
|
||||
BOOST_STATIC_ASSERT(std::is_move_constructible<typename std::decay<F>::type>::value);
|
||||
BOOST_STATIC_ASSERT(boost::asio::execution::can_execute<T, F>::value);
|
||||
BOOST_STATIC_ASSERT(std::is_nothrow_copy_constructible<T>::value);
|
||||
BOOST_STATIC_ASSERT(std::is_nothrow_destructible<T>::value);
|
||||
BOOST_STATIC_ASSERT(boost::asio::traits::equality_comparable<T>::is_valid);
|
||||
BOOST_STATIC_ASSERT(boost::asio::traits::equality_comparable<T>::is_noexcept);
|
||||
BOOST_STATIC_ASSERT(net::execution::is_executor<test_executor>::value);
|
||||
#else
|
||||
BOOST_STATIC_ASSERT(net::is_executor<test_executor>::value);
|
||||
|
@ -98,12 +98,7 @@ public:
|
||||
};
|
||||
|
||||
#if defined(BOOST_ASIO_NO_TS_EXECUTORS)
|
||||
static_assert(net::execution::can_execute<simple_executor, net::execution::invocable_archetype>::value, "");
|
||||
static_assert(std::is_nothrow_copy_constructible<simple_executor>::value, "");
|
||||
static_assert(std::is_nothrow_destructible<simple_executor>::value, "");
|
||||
static_assert(net::traits::equality_comparable<simple_executor>::is_valid, "");
|
||||
static_assert(net::traits::equality_comparable<simple_executor>::is_noexcept, "");
|
||||
static_assert(net::execution::is_executor<simple_executor>::value, "");
|
||||
BOOST_STATIC_ASSERT(net::execution::is_executor<simple_executor>::value);
|
||||
#endif
|
||||
|
||||
// A move-only handler
|
||||
|
@ -288,7 +288,7 @@ struct associated_allocator<handler, Allocator>
|
||||
template<class Executor>
|
||||
struct associated_executor<handler, Executor>
|
||||
{
|
||||
using type = boost::asio::any_io_executor;
|
||||
using type = any_io_executor;
|
||||
|
||||
static
|
||||
type
|
||||
|
@ -38,9 +38,9 @@ namespace ssl = boost::asio::ssl;
|
||||
using tcp = net::ip::tcp;
|
||||
|
||||
net::io_context ioc;
|
||||
auto work = net::any_io_executor(
|
||||
net::any_io_executor work =
|
||||
net::prefer(ioc.get_executor(),
|
||||
net::execution::outstanding_work.tracked));
|
||||
net::execution::outstanding_work.tracked);
|
||||
std::thread t{[&](){ ioc.run(); }};
|
||||
|
||||
error_code ec;
|
||||
|
@ -37,10 +37,10 @@ net::const_buffer get_next_chunk_body()
|
||||
void fxx() {
|
||||
|
||||
net::io_context ioc;
|
||||
auto work = net::any_io_executor(
|
||||
net::any_io_executor work =
|
||||
net::prefer(
|
||||
ioc.get_executor(),
|
||||
net::execution::outstanding_work.tracked));
|
||||
net::execution::outstanding_work.tracked);
|
||||
std::thread t{[&](){ ioc.run(); }};
|
||||
net::ip::tcp::socket sock{ioc};
|
||||
|
||||
|
@ -17,10 +17,10 @@ using tcp = net::ip::tcp;
|
||||
|
||||
error_code ec;
|
||||
net::io_context ioc;
|
||||
auto work = net::any_io_executor(
|
||||
net::any_io_executor work =
|
||||
net::prefer(
|
||||
ioc.get_executor(),
|
||||
net::execution::outstanding_work.tracked));
|
||||
net::execution::outstanding_work.tracked);
|
||||
std::thread t{[&](){ ioc.run(); }};
|
||||
|
||||
tcp::socket sock(ioc);
|
||||
|
Reference in New Issue
Block a user