mirror of
https://github.com/OpenVPN/openvpn.git
synced 2026-05-28 04:03:29 -04:00
management: resync timer on bytecount interval change
coarse_timer_wakeup tracks when the next timer-driven task will occur. If a user issues `bytecount n` via the management interface, but the next scheduled wakeup is more than n seconds away, bandwidth logging will be delayed until that timer fires. To ensure timely logging, reset the timer whenever a new `bytecount` command is received. This guarantees that logging begins exactly n seconds after the command, matching the user-defined interval. Change-Id: Ic0035d52e0ea123398318870d2f4d21af927a602 Signed-off-by: Ralf Lici <ralf@mandelbit.com> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <20250902160050.18640-1-gert@greenie.muc.de> URL: https://sourceforge.net/p/openvpn/mailman/message/59228306/ Signed-off-by: Gert Doering <gert@greenie.muc.de>
This commit is contained in:
parent
da309c1e8b
commit
3bc0b2d0ae
1 changed files with 22 additions and 0 deletions
|
|
@ -514,6 +514,28 @@ man_bytecount(struct management *man, const int update_seconds)
|
|||
man->connection.bytecount_update_seconds = 0;
|
||||
event_timeout_clear(&man->connection.bytecount_update_interval);
|
||||
}
|
||||
|
||||
/* The newly received bytecount interval may be sooner than the existing
|
||||
* coarse timer wakeup. Reset the timer to ensure it fires at the correct,
|
||||
* earlier time.
|
||||
*/
|
||||
if (man->persist.callback.arg)
|
||||
{
|
||||
struct context *c;
|
||||
|
||||
if (man->settings.flags & MF_SERVER)
|
||||
{
|
||||
struct multi_context *m = man->persist.callback.arg;
|
||||
c = &m->top;
|
||||
}
|
||||
else
|
||||
{
|
||||
c = man->persist.callback.arg;
|
||||
}
|
||||
|
||||
reset_coarse_timers(c);
|
||||
}
|
||||
|
||||
msg(M_CLIENT, "SUCCESS: bytecount interval changed");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue