mirror of
https://github.com/matrix-construct/construct
synced 2024-11-17 23:40:57 +01: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
|
namespace ircd::net
|
||||||
{
|
{
|
||||||
|
const uint64_t &id(const socket &);
|
||||||
bool opened(const socket &) noexcept;
|
bool opened(const socket &) noexcept;
|
||||||
size_t readable(const socket &);
|
size_t readable(const socket &);
|
||||||
size_t available(const socket &) noexcept;
|
size_t available(const socket &) noexcept;
|
||||||
|
|
|
@ -46,6 +46,7 @@ struct ircd::net::socket
|
||||||
static uint64_t count; // monotonic
|
static uint64_t count; // monotonic
|
||||||
static uint64_t instances; // current socket count
|
static uint64_t instances; // current socket count
|
||||||
|
|
||||||
|
uint64_t id {++count};
|
||||||
ip::tcp::socket sd;
|
ip::tcp::socket sd;
|
||||||
asio::ssl::stream<ip::tcp::socket &> ssl;
|
asio::ssl::stream<ip::tcp::socket &> ssl;
|
||||||
stat in, out;
|
stat in, out;
|
||||||
|
|
|
@ -185,6 +185,12 @@ catch(...)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const uint64_t &
|
||||||
|
ircd::net::id(const socket &socket)
|
||||||
|
{
|
||||||
|
return socket.id;
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// net/write.h
|
// net/write.h
|
||||||
|
@ -1850,7 +1856,6 @@ ircd::net::socket::socket(asio::ssl::context &ssl,
|
||||||
*ios
|
*ios
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
++count;
|
|
||||||
++instances;
|
++instances;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue