mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 08:12:37 +01:00
ircd: Rename all ios::descriptors w/ consistent dot namespacing.
ircd: Hoist various ios::descriptors out of function-static duration.
This commit is contained in:
parent
af59cc1378
commit
e80629c914
8 changed files with 72 additions and 66 deletions
|
@ -29,6 +29,8 @@ struct ircd::net::acceptor
|
|||
IRCD_EXCEPTION(error, sni_warning)
|
||||
|
||||
static log::log log;
|
||||
static ios::descriptor accept_desc;
|
||||
static ios::descriptor handshake_desc;
|
||||
static conf::item<size_t> handshaking_max;
|
||||
static conf::item<size_t> handshaking_max_per_peer;
|
||||
static conf::item<milliseconds> timeout;
|
||||
|
|
10
ircd/ctx.cc
10
ircd/ctx.cc
|
@ -53,7 +53,7 @@ ircd::ctx::ctx::id_ctr
|
|||
decltype(ircd::ctx::ctx::ios_desc)
|
||||
ircd::ctx::ctx::ios_desc
|
||||
{
|
||||
"ircd::ctx::ctx"
|
||||
"ircd.ctx.ctx"
|
||||
};
|
||||
|
||||
/// This is a pseudo ircd::ios handler. See ios_desc
|
||||
|
@ -721,7 +721,7 @@ noexcept
|
|||
decltype(ircd::ctx::this_ctx::courtesy_yield_desc)
|
||||
ircd::ctx::this_ctx::courtesy_yield_desc
|
||||
{
|
||||
"ircd::ctx courtesy yield"
|
||||
"ircd.ctx.courtesy_yield"
|
||||
};
|
||||
|
||||
// set by the continuation object and the base frame.
|
||||
|
@ -1127,9 +1127,9 @@ namespace ircd::ctx
|
|||
decltype(ircd::ctx::spawn_desc)
|
||||
ircd::ctx::spawn_desc
|
||||
{
|
||||
{ "ircd::ctx::spawn post" },
|
||||
{ "ircd::ctx::spawn defer" },
|
||||
{ "ircd::ctx::spawn dispatch" },
|
||||
{ "ircd.ctx.spawn.post" },
|
||||
{ "ircd.ctx.spawn.defer" },
|
||||
{ "ircd.ctx.spawn.dispatch" },
|
||||
};
|
||||
|
||||
decltype(ircd::ctx::DEFAULT_STACK_SIZE)
|
||||
|
|
|
@ -673,6 +673,43 @@ ircd::fs::aio::system::eventfd_flags
|
|||
EFD_CLOEXEC | EFD_NONBLOCK
|
||||
};
|
||||
|
||||
decltype(ircd::fs::aio::system::chase_descriptor)
|
||||
ircd::fs::aio::system::chase_descriptor
|
||||
{
|
||||
"ircd.fs.aio.chase"
|
||||
};
|
||||
|
||||
decltype(ircd::fs::aio::system::handle_descriptor)
|
||||
ircd::fs::aio::system::handle_descriptor
|
||||
{
|
||||
"ircd.fs.aio.sigfd",
|
||||
|
||||
// allocator; custom allocation strategy because this handler
|
||||
// appears to excessively allocate and deallocate 120 bytes; this
|
||||
// is a simple asynchronous operation, we can do better (and perhaps
|
||||
// even better than this below).
|
||||
[](ios::handler &handler, const size_t &size) -> void *
|
||||
{
|
||||
assert(ircd::fs::aio::system);
|
||||
auto &system(*ircd::fs::aio::system);
|
||||
|
||||
if(unlikely(!system.handle_data))
|
||||
{
|
||||
system.handle_size = size;
|
||||
system.handle_data = std::make_unique<uint8_t[]>(size);
|
||||
}
|
||||
|
||||
assert(system.handle_size == size);
|
||||
return system.handle_data.get();
|
||||
},
|
||||
|
||||
// no deallocation; satisfied by class member unique_ptr
|
||||
[](ios::handler &handler, void *const &ptr, const size_t &size) {},
|
||||
|
||||
// continuation
|
||||
true,
|
||||
};
|
||||
|
||||
//
|
||||
// system::system
|
||||
//
|
||||
|
@ -940,11 +977,6 @@ ircd::fs::aio::system::submit(request &request)
|
|||
// flush the whole queue down to 0.
|
||||
if(qcount == 1)
|
||||
{
|
||||
static ios::descriptor descriptor
|
||||
{
|
||||
"ircd::fs::aio chase"
|
||||
};
|
||||
|
||||
auto handler
|
||||
{
|
||||
std::bind(&system::chase, this)
|
||||
|
@ -952,7 +984,7 @@ ircd::fs::aio::system::submit(request &request)
|
|||
|
||||
ircd::defer
|
||||
{
|
||||
descriptor, std::move(handler)
|
||||
chase_descriptor, std::move(handler)
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1154,37 +1186,6 @@ catch(...)
|
|||
throw;
|
||||
}
|
||||
|
||||
decltype(ircd::fs::aio::system::handle_descriptor)
|
||||
ircd::fs::aio::system::handle_descriptor
|
||||
{
|
||||
"ircd::fs::aio sigfd",
|
||||
|
||||
// allocator; custom allocation strategy because this handler
|
||||
// appears to excessively allocate and deallocate 120 bytes; this
|
||||
// is a simple asynchronous operation, we can do better (and perhaps
|
||||
// even better than this below).
|
||||
[](ios::handler &handler, const size_t &size) -> void *
|
||||
{
|
||||
assert(ircd::fs::aio::system);
|
||||
auto &system(*ircd::fs::aio::system);
|
||||
|
||||
if(unlikely(!system.handle_data))
|
||||
{
|
||||
system.handle_size = size;
|
||||
system.handle_data = std::make_unique<uint8_t[]>(size);
|
||||
}
|
||||
|
||||
assert(system.handle_size == size);
|
||||
return system.handle_data.get();
|
||||
},
|
||||
|
||||
// no deallocation; satisfied by class member unique_ptr
|
||||
[](ios::handler &handler, void *const &ptr, const size_t &size) {},
|
||||
|
||||
// continuation
|
||||
true,
|
||||
};
|
||||
|
||||
/// Handle notifications that requests are complete.
|
||||
void
|
||||
ircd::fs::aio::system::handle(const boost::system::error_code &ec,
|
||||
|
|
|
@ -57,6 +57,7 @@ struct ircd::fs::aio::system
|
|||
size_t handle_size {0};
|
||||
std::unique_ptr<uint8_t[]> handle_data;
|
||||
static ios::descriptor handle_descriptor;
|
||||
static ios::descriptor chase_descriptor;
|
||||
|
||||
/// An eventfd which will be notified by the system; we integrate this with
|
||||
/// the ircd io_service core epoll() event loop. The EFD_SEMAPHORE flag is
|
||||
|
|
|
@ -514,7 +514,7 @@ catch(...)
|
|||
decltype(ircd::fs::iou::system::handle_descriptor)
|
||||
ircd::fs::iou::system::handle_descriptor
|
||||
{
|
||||
"ircd::fs::iou sigfd",
|
||||
"ircd.fs.iou.sigfd",
|
||||
|
||||
// allocator; custom allocation strategy because this handler
|
||||
// appears to excessively allocate and deallocate 120 bytes; this
|
||||
|
|
|
@ -476,7 +476,7 @@ namespace ircd::ios
|
|||
decltype(ircd::ios::dispatch_desc)
|
||||
ircd::ios::dispatch_desc
|
||||
{
|
||||
"ircd::ios dispatch"
|
||||
"ircd.ios.dispatch"
|
||||
};
|
||||
|
||||
[[gnu::hot]]
|
||||
|
@ -568,7 +568,7 @@ namespace ircd::ios
|
|||
decltype(ircd::ios::defer_desc)
|
||||
ircd::ios::defer_desc
|
||||
{
|
||||
"ircd::ios defer",
|
||||
"ircd.ios.defer",
|
||||
};
|
||||
|
||||
[[gnu::hot]]
|
||||
|
@ -639,7 +639,7 @@ namespace ircd::ios
|
|||
decltype(ircd::ios::post_desc)
|
||||
ircd::ios::post_desc
|
||||
{
|
||||
"ircd::ios post"
|
||||
"ircd.ios.post"
|
||||
};
|
||||
|
||||
[[gnu::hot]]
|
||||
|
|
16
ircd/net.cc
16
ircd/net.cc
|
@ -1143,34 +1143,34 @@ ircd::net::socket::instances
|
|||
decltype(ircd::net::socket::desc_connect)
|
||||
ircd::net::socket::desc_connect
|
||||
{
|
||||
"ircd::net::socket connect"
|
||||
"ircd.net.socket.connect"
|
||||
};
|
||||
|
||||
decltype(ircd::net::socket::desc_handshake)
|
||||
ircd::net::socket::desc_handshake
|
||||
{
|
||||
"ircd::net::socket handshake"
|
||||
"ircd.net.socket.handshake"
|
||||
};
|
||||
|
||||
decltype(ircd::net::socket::desc_disconnect)
|
||||
ircd::net::socket::desc_disconnect
|
||||
{
|
||||
"ircd::net::socket disconnect"
|
||||
"ircd.net.socket.disconnect"
|
||||
};
|
||||
|
||||
decltype(ircd::net::socket::desc_timeout)
|
||||
ircd::net::socket::desc_timeout
|
||||
{
|
||||
"ircd::net::socket timeout"
|
||||
"ircd.net.socket.timeout"
|
||||
};
|
||||
|
||||
decltype(ircd::net::socket::desc_wait)
|
||||
ircd::net::socket::desc_wait
|
||||
{
|
||||
{ "ircd::net::socket::wait ready::ANY" },
|
||||
{ "ircd::net::socket::wait ready::READ" },
|
||||
{ "ircd::net::socket::wait ready::WRITE" },
|
||||
{ "ircd::net::socket::wait ready::ERROR" },
|
||||
{ "ircd.net.socket.wait.ready.ANY" },
|
||||
{ "ircd.net.socket.wait.ready.READ" },
|
||||
{ "ircd.net.socket.wait.ready.WRITE" },
|
||||
{ "ircd.net.socket.wait.ready.ERROR" },
|
||||
};
|
||||
|
||||
decltype(ircd::net::socket::total_bytes_in)
|
||||
|
|
|
@ -226,6 +226,18 @@ ircd::net::acceptor::log
|
|||
"net.listen"
|
||||
};
|
||||
|
||||
decltype(ircd::net::acceptor::accept_desc)
|
||||
ircd::net::acceptor::accept_desc
|
||||
{
|
||||
"ircd.net.acceptor.accept"
|
||||
};
|
||||
|
||||
decltype(ircd::net::acceptor::handshake_desc)
|
||||
ircd::net::acceptor::handshake_desc
|
||||
{
|
||||
"ircd.net.acceptor.handshake"
|
||||
};
|
||||
|
||||
decltype(ircd::net::acceptor::timeout)
|
||||
ircd::net::acceptor::timeout
|
||||
{
|
||||
|
@ -476,11 +488,6 @@ bool
|
|||
ircd::net::acceptor::set_handle()
|
||||
try
|
||||
{
|
||||
static ios::descriptor desc
|
||||
{
|
||||
"ircd::net::acceptor accept"
|
||||
};
|
||||
|
||||
const auto &sock
|
||||
{
|
||||
std::make_shared<ircd::socket>(ssl)
|
||||
|
@ -492,7 +499,7 @@ try
|
|||
};
|
||||
|
||||
ip::tcp::socket &sd(*sock);
|
||||
a.async_accept(sd, ios::handle(desc, std::move(handler)));
|
||||
a.async_accept(sd, ios::handle(accept_desc, std::move(handler)));
|
||||
++accepting;
|
||||
return true;
|
||||
}
|
||||
|
@ -561,11 +568,6 @@ noexcept try
|
|||
socket::handshake_type::server
|
||||
};
|
||||
|
||||
static ios::descriptor desc
|
||||
{
|
||||
"ircd::net::acceptor async_handshake"
|
||||
};
|
||||
|
||||
const auto it
|
||||
{
|
||||
handshaking.emplace(end(handshaking), sock)
|
||||
|
@ -577,7 +579,7 @@ noexcept try
|
|||
};
|
||||
|
||||
sock->set_timeout(milliseconds(timeout));
|
||||
sock->ssl.async_handshake(handshake_type, ios::handle(desc, std::move(handshake)));
|
||||
sock->ssl.async_handshake(handshake_type, ios::handle(handshake_desc, std::move(handshake)));
|
||||
assert(!openssl::get_app_data(*sock));
|
||||
openssl::set_app_data(*sock, sock.get());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue