aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Socket.h
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2025-03-11 16:35:08 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2025-03-11 16:36:06 +0100
commit6517cc3078eba96ea96e085d033a4b8a96eb7151 (patch)
tree6a8d2aee0cf00cd76263bfdca58da6a934547b40 /lib/Socket.h
parent84a7a40492b3db9f204f48262481e60a1268f469 (diff)
downloaddabmux-6517cc3078eba96ea96e085d033a4b8a96eb7151.tar.gz
dabmux-6517cc3078eba96ea96e085d033a4b8a96eb7151.tar.bz2
dabmux-6517cc3078eba96ea96e085d033a4b8a96eb7151.zip
Add EDI/TCP number of active connections statisticsnext
Diffstat (limited to 'lib/Socket.h')
-rw-r--r--lib/Socket.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Socket.h b/lib/Socket.h
index 7709145..29b618a 100644
--- a/lib/Socket.h
+++ b/lib/Socket.h
@@ -213,6 +213,8 @@ class TCPSocket {
SOCKET get_sockfd() const { return m_sock; }
+ InetAddress get_remote_address() const { return m_remote_address; }
+
private:
explicit TCPSocket(int sockfd);
explicit TCPSocket(int sockfd, InetAddress remote_address);
@@ -254,6 +256,12 @@ class TCPConnection
ThreadsafeQueue<std::vector<uint8_t> > queue;
+ struct stats_t {
+ size_t buffer_fullness = 0;
+ InetAddress remote_address;
+ };
+ stats_t get_stats() const;
+
private:
std::atomic<bool> m_running;
std::thread m_sender_thread;
@@ -276,6 +284,8 @@ class TCPDataDispatcher
void start(int port, const std::string& address);
void write(const std::vector<uint8_t>& data);
+ std::vector<TCPConnection::stats_t> get_stats() const;
+
private:
void process();