40#define SHAPER_MAX 100000000
42#define SHAPER_MAX_TIMEOUT 10
110 return delay > 0 ? delay : 0;
143 "SHAPER shaper_wrote_bytes bytes=%d delay=%ld sec=%" PRIi64
" usec=%ld", nbytes,
144 (
long)tv.tv_usec, (int64_t)s->
wakeup.tv_sec, (
long)s->
wakeup.tv_usec);
156shaper_change_pct(
struct shaper *s,
int pct)
159 const int new_bandwidth = orig_bandwidth + (orig_bandwidth * pct / 100);
static int min_int(int x, int y)
static int max_int(int x, int y)
static int constrain_int(int x, int min, int max)
static int tv_subtract(const struct timeval *tv1, const struct timeval *tv2, const unsigned int max_seconds)
static int openvpn_gettimeofday(struct timeval *tv, void *tz)
static bool tv_defined(const struct timeval *tv)
static void tv_add(struct timeval *dest, const struct timeval *src)
void shaper_msg(struct shaper *s)
static void shaper_wrote_bytes(struct shaper *s, int nbytes)
static void shaper_reset(struct shaper *s, int bytes_per_second)
#define SHAPER_MAX_TIMEOUT
void shaper_reset_wakeup(struct shaper *s)
static void shaper_init(struct shaper *s, int bytes_per_second)
static int shaper_delay(struct shaper *s)
bool shaper_soonest_event(struct timeval *tv, int delay)