summaryrefslogtreecommitdiffstats
path: root/forward.c
diff options
context:
space:
mode:
authorJames Yonan <james@openvpn.net>2011-10-18 08:12:51 +0000
committerDavid Sommerseth <davids@redhat.com>2011-12-14 17:03:24 +0100
commitffea644ce62a67ea06e375c17277cea4e9cb9873 (patch)
treef9d897b7b3b6d54474d846de9a54ffc1b1c7cc60 /forward.c
parent359adbf136e07011ad6733c3ba679b2d5cc47fdc (diff)
downloadopenvpn-ffea644ce62a67ea06e375c17277cea4e9cb9873.tar.gz
openvpn-ffea644ce62a67ea06e375c17277cea4e9cb9873.tar.xz
openvpn-ffea644ce62a67ea06e375c17277cea4e9cb9873.zip
Added "memstats" option to maintain real-time operating stats
in a memory-mapped file. Version 2.1.16 git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@7653 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'forward.c')
-rw-r--r--forward.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/forward.c b/forward.c
index 4592cfc..c66031f 100644
--- a/forward.c
+++ b/forward.c
@@ -39,6 +39,7 @@
#include "forward-inline.h"
#include "occ-inline.h"
#include "ping-inline.h"
+#include "mstats.h"
counter_type link_read_bytes_global; /* GLOBAL */
counter_type link_write_bytes_global; /* GLOBAL */
@@ -738,6 +739,10 @@ process_incoming_link (struct context *c)
{
c->c2.link_read_bytes += c->c2.buf.len;
link_read_bytes_global += c->c2.buf.len;
+#ifdef ENABLE_MEMSTATS
+ if (mmap_stats)
+ mmap_stats->link_read_bytes = link_read_bytes_global;
+#endif
c->c2.original_recv_size = c->c2.buf.len;
#ifdef ENABLE_MANAGEMENT
if (management)
@@ -1137,6 +1142,10 @@ process_outgoing_link (struct context *c)
c->c2.max_send_size_local = max_int (size, c->c2.max_send_size_local);
c->c2.link_write_bytes += size;
link_write_bytes_global += size;
+#ifdef ENABLE_MEMSTATS
+ if (mmap_stats)
+ mmap_stats->link_write_bytes = link_write_bytes_global;
+#endif
#ifdef ENABLE_MANAGEMENT
if (management)
{