OpenVPN
Functions
interval.c File Reference
#include "syshead.h"
#include "interval.h"
#include "memdbg.h"
Include dependency graph for interval.c:

Go to the source code of this file.

Functions

void interval_init (struct interval *top, int horizon, int refresh)
 
bool event_timeout_trigger (struct event_timeout *et, struct timeval *tv, const int et_const_retry)
 This is the principal function for testing and triggering recurring timers. More...
 

Function Documentation

◆ event_timeout_trigger()

bool event_timeout_trigger ( struct event_timeout et,
struct timeval *  tv,
int  et_const_retry 
)

This is the principal function for testing and triggering recurring timers.

If *et is not triggered, *tv is set to remaining time until the timeout if not already lower:

 *tv = minimum(*tv, event_timeout_remaining(*et))

If *et triggers and et_const_retry is negative (ETT_DEFAULT is -1):

  • the function will return true
  • *et will be armed for the next event (et->last set to now).
  • *tv will be lowered to the event period (n) if larger than the period of the event (set to *et's next timeout)
  • *et will not changed (ie also not rearmed, stays armed)

If *et triggers and et_const_retry >= 0, *tv will be lowered to et_const_try if larger:

*tv = *minimum(*tv, et_const_retry)

This is mainly useful if the trigger cannot yet be triggered for other reasons and a backoff timeout should be returned if the timer is ready to trigger.

Parameters
etthe timeout to check
tvwill be set to timeout for next check for this timeout unless already smaller.
et_const_retrysee above
Returns
if the timeout has triggered and event has been reset

Definition at line 43 of file interval.c.

References D_INTERVAL, event_timeout::defined, dmsg, event_timeout_remaining(), event_timeout::last, event_timeout::n, and now.

Referenced by check_add_routes(), check_ping_restart(), check_ping_send(), check_send_occ_load_test(), check_send_occ_req(), check_session_timeout(), management_check_bytecount(), process_coarse_timers(), process_explicit_exit_notification_timer_wakeup(), stale_route_check_trigger(), and status_trigger().

◆ interval_init()

void interval_init ( struct interval top,
int  horizon,
int  refresh 
)

Definition at line 35 of file interval.c.

References CLEAR, interval::horizon, and interval::refresh.

Referenced by do_init_timers().