diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index 422aa0bc..5b2a7deb 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -500,6 +500,13 @@ man_status(struct management *man, const int version, struct status_output *so) } } +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) { @@ -511,8 +518,7 @@ man_bytecount(struct management *man, const int update_seconds) } 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 @@ man_reset_client_socket(struct management *man, const bool exiting) { if (socket_defined(man->connection.sd_cli)) { + man_bytecount_stop(man); #ifdef _WIN32 man_stop_ne32(man); #endif