Message ID | 20250902163514.22339-1-gert@greenie.muc.de |
---|---|
State | New |
Headers | show |
Series | [Openvpn-devel,v1] management: stop bytecount on client disconnection | expand |
"Does what it says on the lid". Tested on Linux+DCO client - without the patch, with "bytecount 1", after management client disconnect the log would happily show more "dco_get_peer()" calls, one per second. With the patch, these properly stop (as with "bytecount 0", so that one also still works). Your patch has been applied to the master branch. commit fccdb21733d2826bcdc080fdfa93b0283b5231b8 Author: Ralf Lici Date: Tue Sep 2 18:35:09 2025 +0200 management: stop bytecount on client disconnection Signed-off-by: Ralf Lici <ralf@mandelbit.com> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <20250902163514.22339-1-gert@greenie.muc.de> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg32765.html Signed-off-by: Gert Doering <gert@greenie.muc.de> -- kind regards, Gert Doering
diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index 422aa0b..5b2a7de 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -501,6 +501,13 @@ } static void +man_bytecount_stop(struct management *man) +{ + man->connection.bytecount_update_seconds = 0; + event_timeout_clear(&man->connection.bytecount_update_interval); +} + +static void man_bytecount(struct management *man, const int update_seconds) { if (update_seconds > 0) @@ -511,8 +518,7 @@ } else { - man->connection.bytecount_update_seconds = 0; - event_timeout_clear(&man->connection.bytecount_update_interval); + man_bytecount_stop(man); } /* The newly received bytecount interval may be sooner than the existing @@ -1992,6 +1998,7 @@ { if (socket_defined(man->connection.sd_cli)) { + man_bytecount_stop(man); #ifdef _WIN32 man_stop_ne32(man); #endif