#pragma once
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
namespace asio = boost::asio;
namespace beast = boost::beast;
namespace base {
// if we need strands this is here just in case :)
using BaseExecutorType = asio::any_io_executor;
using ExecutorType = BaseExecutorType;
/// Awaitable type (configured for the current executor)
template
using Awaitable = asio::awaitable;
template
using Acceptor = asio::basic_socket_acceptor;
template
using Socket = asio::basic_stream_socket;
using SteadyTimer = asio::basic_waitable_timer, ExecutorType>;
template
using BeastStream = beast::basic_stream;
/// Exception boilerplate
inline auto DefCoroCompletion(std::string_view name) {
// N.B: name is expected to be a literal
return [name](auto ep) {
if(ep) {
try {
std::rethrow_exception(ep);
} catch(std::exception& e) {
BASE_CHECK(false, "Unhandled exception in task \"{}\": {}", name, e.what());
}
}
};
}
} // namespace base