0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 08:12:37 +01:00

ircd::net: Expose interface for socket stat counter.

This commit is contained in:
Jason Volk 2018-04-13 17:18:31 -07:00
parent 69aeddad61
commit 6ca4f6eec5
2 changed files with 22 additions and 0 deletions

View file

@ -53,6 +53,8 @@ namespace ircd::net
size_t available(const socket &) noexcept;
ipport local_ipport(const socket &) noexcept;
ipport remote_ipport(const socket &) noexcept;
std::pair<size_t, size_t> bytes(const socket &) noexcept; // <in, out>
std::pair<size_t, size_t> calls(const socket &) noexcept; // <in, out>
const_buffer peer_cert_der(const mutable_buffer &, const socket &);
}

View file

@ -71,6 +71,26 @@ ircd::net::peer_cert_der(const mutable_buffer &buf,
return openssl::i2d(buf, cert);
}
std::pair<size_t, size_t>
ircd::net::calls(const socket &socket)
noexcept
{
return
{
socket.in.calls, socket.out.calls
};
}
std::pair<size_t, size_t>
ircd::net::bytes(const socket &socket)
noexcept
{
return
{
socket.in.bytes, socket.out.bytes
};
}
ircd::net::ipport
ircd::net::remote_ipport(const socket &socket)
noexcept try