mirror of
https://github.com/matrix-construct/construct
synced 2024-12-25 15:04:10 +01:00
fixup! Pin boost to 1.66.0.
This commit is contained in:
parent
c77ee478e5
commit
9871332957
7 changed files with 37 additions and 37 deletions
|
@ -64,11 +64,11 @@ lgetopt opts[] =
|
|||
{ nullptr, nullptr, lgetopt::STRING, nullptr },
|
||||
};
|
||||
|
||||
std::unique_ptr<boost::asio::io_service> ios
|
||||
std::unique_ptr<boost::asio::io_context> ios
|
||||
{
|
||||
// Having trouble with static destruction in clang so this
|
||||
// has to become still-reachable
|
||||
std::make_unique<boost::asio::io_service>()
|
||||
std::make_unique<boost::asio::io_context>()
|
||||
};
|
||||
|
||||
boost::asio::signal_set sigs
|
||||
|
@ -103,14 +103,14 @@ try
|
|||
configfile?: fs::get(fs::IRCD_CONF)
|
||||
};
|
||||
|
||||
// Associates libircd with our io_service and posts the initial routines
|
||||
// to that io_service. Execution of IRCd will then occur during ios::run()
|
||||
// Associates libircd with our io_context and posts the initial routines
|
||||
// to that io_context. Execution of IRCd will then occur during ios::run()
|
||||
ircd::init(*ios, confpath);
|
||||
|
||||
// libircd does no signal handling (or at least none that you ever have to
|
||||
// care about); reaction to all signals happens out here instead. Handling
|
||||
// is done properly through the io_service which registers the handler for
|
||||
// the platform and then safely posts the received signal to the io_service
|
||||
// is done properly through the io_context which registers the handler for
|
||||
// the platform and then safely posts the received signal to the io_context
|
||||
// event loop. This means we lose the true instant hardware-interrupt gratitude
|
||||
// of signals but with the benefit of unconditional safety and cross-
|
||||
// platformness with windows etc.
|
||||
|
@ -123,7 +123,7 @@ try
|
|||
sigs.add(SIGUSR2);
|
||||
sigs.async_wait(sigfd_handler);
|
||||
|
||||
// Because we registered signal handlers with the io_service, ios->run()
|
||||
// Because we registered signal handlers with the io_context, ios->run()
|
||||
// is now shared between those handlers and libircd. This means the run()
|
||||
// won't return even if we call ircd::stop(). We use the callback to then
|
||||
// cancel the handlers so run() can return and the program can exit.
|
||||
|
|
|
@ -692,7 +692,7 @@ dnl
|
|||
dnl boost support
|
||||
dnl
|
||||
|
||||
BOOST_VERSION_MIN="1.61"
|
||||
BOOST_VERSION_MIN="1.66"
|
||||
BOOST_VERSION_MIN_PATCH="0"
|
||||
BOOST_BUILT_LIBS="system,filesystem,context,coroutine"
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
/// forward declarations.
|
||||
namespace boost::asio
|
||||
{
|
||||
struct io_service; // Allow a reference to an ios to be passed to ircd
|
||||
struct io_context;
|
||||
}
|
||||
|
||||
namespace ircd
|
||||
|
@ -44,7 +44,7 @@ namespace ircd
|
|||
extern std::thread::id thread_id;
|
||||
|
||||
/// The user's io_service
|
||||
extern asio::io_service *ios;
|
||||
extern asio::io_context *ios;
|
||||
|
||||
/// IRCd's strand of the io_service
|
||||
struct strand extern *strand;
|
||||
|
|
|
@ -39,8 +39,8 @@ namespace ircd
|
|||
extern runlevel_handler runlevel_changed;
|
||||
|
||||
string_view reflect(const enum runlevel &);
|
||||
void init(boost::asio::io_service &ios, const std::string &conf, runlevel_handler = {});
|
||||
void init(boost::asio::io_service &ios, runlevel_handler = {});
|
||||
void init(boost::asio::io_context &ios, const std::string &conf, runlevel_handler = {});
|
||||
void init(boost::asio::io_context &ios, runlevel_handler = {});
|
||||
bool quit() noexcept;
|
||||
}
|
||||
|
||||
|
|
|
@ -351,13 +351,13 @@ noexcept try
|
|||
catch(const boost::system::system_error &e)
|
||||
{
|
||||
using namespace boost::system::errc;
|
||||
using boost::system::get_system_category;
|
||||
using boost::system::system_category;
|
||||
using boost::asio::error::get_ssl_category;
|
||||
using boost::asio::error::get_misc_category;
|
||||
|
||||
const error_code &ec{e.code()};
|
||||
const int &value{ec.value()};
|
||||
if(ec.category() == get_system_category()) switch(value)
|
||||
if(ec.category() == system_category()) switch(value)
|
||||
{
|
||||
case success:
|
||||
assert(0);
|
||||
|
@ -493,11 +493,11 @@ ircd::handle_ec(client &client,
|
|||
const net::error_code &ec)
|
||||
{
|
||||
using namespace boost::system::errc;
|
||||
using boost::system::get_system_category;
|
||||
using boost::system::system_category;
|
||||
using boost::asio::error::get_ssl_category;
|
||||
using boost::asio::error::get_misc_category;
|
||||
|
||||
if(ec.category() == get_system_category()) switch(ec.value())
|
||||
if(ec.category() == system_category()) switch(ec.value())
|
||||
{
|
||||
case success: return handle_ec_success(client);
|
||||
case operation_canceled: return handle_ec_timeout(client);
|
||||
|
|
28
ircd/ircd.cc
28
ircd/ircd.cc
|
@ -35,7 +35,7 @@ namespace ircd
|
|||
const enum runlevel &runlevel{_runlevel}; // Observer for current RL
|
||||
runlevel_handler runlevel_changed; // user's callback
|
||||
|
||||
boost::asio::io_service *ios; // user's io service
|
||||
boost::asio::io_context *ios; // user's io service
|
||||
struct strand *strand; // libircd event serializer
|
||||
|
||||
std::string _conf; // JSON read from configfile
|
||||
|
@ -89,7 +89,7 @@ ircd::boost_version[3]
|
|||
};
|
||||
|
||||
void
|
||||
ircd::init(boost::asio::io_service &ios,
|
||||
ircd::init(boost::asio::io_context &ios,
|
||||
runlevel_handler function)
|
||||
{
|
||||
init(ios, std::string{}, std::move(function));
|
||||
|
@ -97,15 +97,15 @@ ircd::init(boost::asio::io_service &ios,
|
|||
|
||||
/// Sets up the IRCd and its main context, then returns without blocking.
|
||||
//
|
||||
/// Pass your io_service instance, it will share it with the rest of your program.
|
||||
/// Pass your io_context instance, it will share it with the rest of your program.
|
||||
/// An exception will be thrown on error.
|
||||
///
|
||||
/// This function will setup the main program loop of libircd. The execution will
|
||||
/// occur when your io_service.run() or poll() is further invoked.
|
||||
/// occur when your io_context.run() or poll() is further invoked.
|
||||
///
|
||||
/// init() can only be called from a runlevel::HALT state
|
||||
void
|
||||
ircd::init(boost::asio::io_service &ios,
|
||||
ircd::init(boost::asio::io_context &ios,
|
||||
const std::string &configfile,
|
||||
runlevel_handler runlevel_changed)
|
||||
try
|
||||
|
@ -124,7 +124,7 @@ try
|
|||
// threads, but we consider this one thread a main thread for now...
|
||||
ircd::thread_id = std::this_thread::get_id();
|
||||
|
||||
// Global ircd:: reference to the user's io_service and setup our main
|
||||
// Global ircd:: reference to the user's io_context and setup our main
|
||||
// strand on that service.
|
||||
ircd::ios = &ios;
|
||||
ircd::strand = new struct strand(ios);
|
||||
|
@ -177,11 +177,11 @@ try
|
|||
// ircd::main(). The main_context is the first ircd::ctx to be spawned
|
||||
// and will be the last to finish.
|
||||
//
|
||||
// The context::POST will delay this spawn until the next io_service
|
||||
// The context::POST will delay this spawn until the next io_context
|
||||
// event slice, so no context switch will occur here. Note that POST has
|
||||
// to be used here because: A. This init() function is executing on the
|
||||
// main stack, and context switches can only occur between context stacks,
|
||||
// not between contexts and the main stack. B. The user's io_service may or
|
||||
// not between contexts and the main stack. B. The user's io_context may or
|
||||
// may not even be running yet anyway.
|
||||
//
|
||||
ircd::context main_context
|
||||
|
@ -214,8 +214,8 @@ catch(const std::exception &e)
|
|||
/// is observed the user is free to destruct all resources related to libircd.
|
||||
///
|
||||
/// This function is the proper way to shutdown libircd after an init(), and while
|
||||
/// your io_service.run() is invoked without stopping your io_service shared by
|
||||
/// other activities unrelated to libircd. If your io_service has no other activities
|
||||
/// your io_context.run() is invoked without stopping your io_context shared by
|
||||
/// other activities unrelated to libircd. If your io_context has no other activities
|
||||
/// the run() will then return immediately after IRCd posts its transition to
|
||||
/// the HALT state.
|
||||
///
|
||||
|
@ -245,7 +245,7 @@ noexcept
|
|||
/// the ircd::runlevel. The ircd::runlevel_changed callback can be set
|
||||
/// to be notified on a runlevel change. The user should wait for a runlevel
|
||||
/// of HALT before destroying IRCd related resources and stopping their
|
||||
/// io_service from running more jobs.
|
||||
/// io_context from running more jobs.
|
||||
///
|
||||
void
|
||||
ircd::main()
|
||||
|
@ -343,9 +343,9 @@ noexcept
|
|||
/// manually/directly, as it doesn't trigger a runlevel change itself, it just
|
||||
/// notifies of one.
|
||||
///
|
||||
/// The notification will be posted to the io_service. This is important to
|
||||
/// The notification will be posted to the io_context. This is important to
|
||||
/// prevent the callback from continuing execution on some ircd::ctx stack and
|
||||
/// instead invoke their function on the main stack in their own io_service
|
||||
/// instead invoke their function on the main stack in their own io_context
|
||||
/// event slice.
|
||||
void
|
||||
ircd::set_runlevel(const enum runlevel &new_runlevel)
|
||||
|
@ -359,7 +359,7 @@ try
|
|||
ircd::_runlevel = new_runlevel;
|
||||
|
||||
// This function will notify the user of the change to IRCd. The
|
||||
// notification is posted to the io_service ensuring THERE IS NO
|
||||
// notification is posted to the io_context ensuring THERE IS NO
|
||||
// CONTINUATION ON THIS STACK by the user.
|
||||
if(ircd::runlevel_changed)
|
||||
ios->post([new_runlevel]
|
||||
|
|
14
ircd/net.cc
14
ircd/net.cc
|
@ -462,7 +462,7 @@ ircd::net::listener::acceptor::accept_error(const error_code &ec,
|
|||
socket &sock)
|
||||
{
|
||||
using namespace boost::system::errc;
|
||||
using boost::system::get_system_category;
|
||||
using boost::system::system_category;
|
||||
|
||||
if(unlikely(interrupting))
|
||||
throw ctx::interrupted();
|
||||
|
@ -470,7 +470,7 @@ ircd::net::listener::acceptor::accept_error(const error_code &ec,
|
|||
if(likely(ec == success))
|
||||
return false;
|
||||
|
||||
if(ec.category() == get_system_category()) switch(ec.value())
|
||||
if(ec.category() == system_category()) switch(ec.value())
|
||||
{
|
||||
case operation_canceled:
|
||||
return false;
|
||||
|
@ -537,7 +537,7 @@ bool
|
|||
ircd::net::listener::acceptor::handshake_error(const error_code &ec,
|
||||
socket &sock)
|
||||
{
|
||||
using boost::system::get_system_category;
|
||||
using boost::system::system_category;
|
||||
using namespace boost::system::errc;
|
||||
|
||||
if(unlikely(interrupting))
|
||||
|
@ -546,7 +546,7 @@ ircd::net::listener::acceptor::handshake_error(const error_code &ec,
|
|||
if(likely(ec == success))
|
||||
return false;
|
||||
|
||||
if(ec.category() == get_system_category()) switch(ec.value())
|
||||
if(ec.category() == system_category()) switch(ec.value())
|
||||
{
|
||||
case operation_canceled:
|
||||
return false;
|
||||
|
@ -1258,7 +1258,7 @@ bool
|
|||
ircd::net::socket::handle_error(const error_code &ec)
|
||||
{
|
||||
using namespace boost::system::errc;
|
||||
using boost::system::get_system_category;
|
||||
using boost::system::system_category;
|
||||
using boost::asio::error::get_ssl_category;
|
||||
using boost::asio::error::get_misc_category;
|
||||
|
||||
|
@ -1269,7 +1269,7 @@ ircd::net::socket::handle_error(const error_code &ec)
|
|||
this,
|
||||
string(ec));
|
||||
|
||||
if(ec.category() == get_system_category()) switch(ec.value())
|
||||
if(ec.category() == system_category()) switch(ec.value())
|
||||
{
|
||||
// A cancel is triggered either by the timeout handler or by
|
||||
// a request to shutdown/close the socket. We only call the user's
|
||||
|
@ -1330,7 +1330,7 @@ noexcept try
|
|||
// A cancelation means there was no timeout.
|
||||
case operation_canceled:
|
||||
{
|
||||
assert(ec.category() == boost::system::get_system_category());
|
||||
assert(ec.category() == boost::system::system_category());
|
||||
assert(timedout == false);
|
||||
timedout = false;
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue