From 6ca4f6eec5a79a000e7b95558e8a8ff853868c68 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Fri, 13 Apr 2018 17:18:31 -0700 Subject: [PATCH] ircd::net: Expose interface for socket stat counter. --- include/ircd/net/net.h | 2 ++ ircd/net.cc | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/include/ircd/net/net.h b/include/ircd/net/net.h index 29d3d8b9b..620e650b6 100644 --- a/include/ircd/net/net.h +++ b/include/ircd/net/net.h @@ -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 bytes(const socket &) noexcept; // + std::pair calls(const socket &) noexcept; // const_buffer peer_cert_der(const mutable_buffer &, const socket &); } diff --git a/ircd/net.cc b/ircd/net.cc index 07ce83295..78c6dfbe0 100644 --- a/ircd/net.cc +++ b/ircd/net.cc @@ -71,6 +71,26 @@ ircd::net::peer_cert_der(const mutable_buffer &buf, return openssl::i2d(buf, cert); } +std::pair +ircd::net::calls(const socket &socket) +noexcept +{ + return + { + socket.in.calls, socket.out.calls + }; +} + +std::pair +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