mirror of
https://github.com/matrix-construct/construct
synced 2024-09-30 04:38:52 +02:00
ircd::net: Expose interface to get socket counter as an ID.
This commit is contained in:
parent
8d7bf8dc88
commit
cb6f0032a4
3 changed files with 8 additions and 1 deletions
|
@ -49,6 +49,7 @@ namespace ircd::net
|
|||
|
||||
namespace ircd::net
|
||||
{
|
||||
const uint64_t &id(const socket &);
|
||||
bool opened(const socket &) noexcept;
|
||||
size_t readable(const socket &);
|
||||
size_t available(const socket &) noexcept;
|
||||
|
|
|
@ -46,6 +46,7 @@ struct ircd::net::socket
|
|||
static uint64_t count; // monotonic
|
||||
static uint64_t instances; // current socket count
|
||||
|
||||
uint64_t id {++count};
|
||||
ip::tcp::socket sd;
|
||||
asio::ssl::stream<ip::tcp::socket &> ssl;
|
||||
stat in, out;
|
||||
|
|
|
@ -185,6 +185,12 @@ catch(...)
|
|||
return false;
|
||||
}
|
||||
|
||||
const uint64_t &
|
||||
ircd::net::id(const socket &socket)
|
||||
{
|
||||
return socket.id;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// net/write.h
|
||||
|
@ -1850,7 +1856,6 @@ ircd::net::socket::socket(asio::ssl::context &ssl,
|
|||
*ios
|
||||
}
|
||||
{
|
||||
++count;
|
||||
++instances;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue