0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-25 23:14:13 +01:00

ircd: Remove ircd::error_code typedef with more local typedefs.

This commit is contained in:
Jason Volk 2018-03-08 09:27:32 -08:00
parent f10c61e046
commit 4670fdbd1b
8 changed files with 30 additions and 10 deletions

View file

@ -25,8 +25,6 @@ namespace ircd
{
/// Alias so that asio:: can be used
namespace asio = boost::asio;
namespace errc = boost::system::errc;
using boost::system::error_code;
/// A record of the thread ID when static initialization took place (for ircd.cc)
extern const std::thread::id static_thread_id;

View file

@ -29,6 +29,8 @@ namespace ircd::net
IRCD_EXCEPTION(error, inauthentic)
IRCD_EXCEPTION(error, not_found)
using error_code = boost::system::error_code;
// SNOMASK 'N' "net"
extern struct log::log log;
}

View file

@ -26,6 +26,8 @@ namespace ircd::server
IRCD_EXCEPTION(error, unavailable);
IRCD_EXCEPTION(error, canceled);
using error_code = boost::system::error_code;
extern ircd::log::log log;
extern std::map<string_view, std::shared_ptr<peer>> peers;

View file

@ -44,7 +44,7 @@ ircd::fs::aio::set_handle()
/// Handle notifications that requests are complete.
void
ircd::fs::aio::handle(const error_code &ec,
ircd::fs::aio::handle(const boost::system::error_code &ec,
const size_t bytes)
noexcept
{

View file

@ -40,7 +40,7 @@ struct ircd::fs::aio
// Callback stack invoked when the sigfd is notified of completed events.
void handle_event(const io_event &) noexcept;
void handle_events() noexcept;
void handle(const error_code &, const size_t) noexcept;
void handle(const boost::system::error_code &, const size_t) noexcept;
void set_handle();
aio();

View file

@ -213,6 +213,8 @@ ircd::remote(const client &client)
namespace ircd
{
using error_code = boost::system::error_code;
static bool handle_ec_default(client &, const error_code &);
static bool handle_ec_timeout(client &);
static bool handle_ec_short_read(client &);

View file

@ -222,6 +222,11 @@ ircd::fs::write__std(const string_view &path,
return buf;
}
///////////////////////////////////////////////////////////////////////////////
//
// fs.h / misc
//
void
ircd::fs::chdir(const string_view &path)
try
@ -282,7 +287,7 @@ bool
ircd::fs::remove(std::nothrow_t,
const string_view &path)
{
error_code ec;
boost::system::error_code ec;
return filesystem::remove(fs::path(path), ec);
}
@ -306,7 +311,7 @@ ircd::fs::rename(std::nothrow_t,
const string_view &old,
const string_view &new_)
{
error_code ec;
boost::system::error_code ec;
filesystem::rename(path(old), path(new_), ec);
return !ec;
}

View file

@ -351,7 +351,7 @@ ircd::net::wait(use_future_t,
}
/// Wait for socket to become "ready"; yields ircd::ctx returning code.
ircd::error_code
ircd::net::error_code
ircd::net::wait(nothrow_t,
socket &socket,
const wait_opts &wait_opts)
@ -1408,7 +1408,11 @@ ircd::net::socket::wait(const wait_opts &opts,
wait(opts, [callback(std::move(callback))]
(const error_code &ec)
{
callback(make_eptr(ec));
if(likely(!ec))
return callback(std::exception_ptr{});
using boost::system::system_error;
callback(std::make_exception_ptr(system_error{ec}));
});
}
@ -1961,7 +1965,11 @@ ircd::net::socket::call_user(const eptr_handler &callback,
const error_code &ec)
noexcept try
{
callback(make_eptr(ec));
if(likely(!ec))
return callback(std::exception_ptr{});
using boost::system::system_error;
callback(std::make_exception_ptr(system_error{ec}));
}
catch(const std::exception &e)
{
@ -2476,7 +2484,10 @@ ircd::net::dns::resolver::check_timeout(const uint16_t &id,
};
if(tag.cb)
tag.cb(make_eptr(ec), {});
{
using boost::system::system_error;
tag.cb(std::make_exception_ptr(system_error{ec}), {});
}
return false;
}