0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-03-16 22:41:46 +01:00

ircd: Fwd declare boost::system::error_code; minor cleanup.

This commit is contained in:
Jason Volk 2018-01-08 03:01:33 -08:00
parent 274b4b43ed
commit 54d6cbc8c1
4 changed files with 20 additions and 15 deletions

View file

@ -22,11 +22,17 @@
#pragma once
#define HAVE_IRCD_IOS_H
// Boost headers are not exposed to our users unless explicitly included by a
// definition file. Other libircd headers may extend this namespace with more
// forward declarations.
/// Forward declarations for boost::system because it is not included here.
namespace boost::system
{
struct error_code;
}
/// Forward declarations for boost::asio because it is not included here.
///
/// Boost headers are not exposed to our users unless explicitly included by a
/// definition file. Other libircd headers may extend this namespace with more
/// forward declarations.
namespace boost::asio
{
struct io_context;
@ -36,6 +42,7 @@ namespace ircd
{
/// Alias so that asio:: can be used
namespace asio = boost::asio;
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

@ -33,7 +33,6 @@
namespace ircd::net
{
namespace ip = asio::ip;
using boost::system::error_code;
using asio::steady_timer;
using ircd::string;
@ -49,7 +48,6 @@ namespace ircd::net
namespace ircd
{
using net::error_code;
using net::string;
using net::addr;
using net::host;

View file

@ -32,6 +32,9 @@
///
namespace ircd::net
{
struct init;
struct socket;
IRCD_EXCEPTION(ircd::error, error)
IRCD_EXCEPTION(error, invalid_argument)
IRCD_EXCEPTION(error, nxdomain)
@ -39,9 +42,6 @@ namespace ircd::net
IRCD_EXCEPTION(error, disconnected)
IRCD_EXCEPTION(error, inauthentic)
struct init;
struct socket;
// SNOMASK 'N' "net"
extern struct log::log log;
}

View file

@ -54,7 +54,7 @@ ctx::pool request
// Container for all active clients (connections) for iteration purposes.
client::list client::clients;
static bool handle_ec(client &, const net::error_code &);
static bool handle_ec(client &, const error_code &);
void async_recv_next(std::shared_ptr<client>, const milliseconds &timeout);
void async_recv_next(std::shared_ptr<client>);
@ -237,7 +237,7 @@ ircd::async_recv_next(std::shared_ptr<client> client,
auto &sock(*client->sock);
static const auto &op{sock.sd.wait_read};
sock(op, timeout, [client(std::move(client)), timeout](const net::error_code &ec)
sock(op, timeout, [client(std::move(client)), timeout](const error_code &ec)
noexcept
{
// Right here this handler is executing on the main stack (not in any
@ -356,7 +356,7 @@ try
const socket::scope_timeout timeout
{
*sock, request_timeout, [client(shared_from(*this))]
(const net::error_code &ec)
(const error_code &ec)
{
if(!ec)
close(*client, net::dc::SSL_NOTIFY, net::close_ignore);
@ -498,12 +498,12 @@ namespace ircd
static bool handle_ec_timeout(client &);
static bool handle_ec_eof(client &);
static bool handle_ec_short_read(client &);
static bool handle_ec_default(client &, const net::error_code &);
static bool handle_ec_default(client &, const error_code &);
}
bool
ircd::handle_ec(client &client,
const net::error_code &ec)
const error_code &ec)
{
using namespace boost::system::errc;
using boost::system::system_category;
@ -531,7 +531,7 @@ ircd::handle_ec(client &client,
bool
ircd::handle_ec_default(client &client,
const net::error_code &ec)
const error_code &ec)
{
log::debug("client(%p): %s: %s",
&client,