Slightly randomize all timeouts.
This commit is contained in:
parent
717ea66d7b
commit
edc08b73a9
6 changed files with 11 additions and 11 deletions
|
@ -164,7 +164,7 @@ static void timeout_handler(int fd, short events, void *event) {
|
|||
}
|
||||
}
|
||||
|
||||
event_add(event, &(struct timeval){pingtimeout, 0});
|
||||
event_add(event, &(struct timeval){pingtimeout, rand() % 100000});
|
||||
}
|
||||
|
||||
static void periodic_handler(int fd, short events, void *event) {
|
||||
|
@ -278,7 +278,7 @@ static void periodic_handler(int fd, short events, void *event) {
|
|||
}
|
||||
}
|
||||
|
||||
event_add(event, &(struct timeval){5, 0});
|
||||
event_add(event, &(struct timeval){5, rand() % 100000});
|
||||
}
|
||||
|
||||
void handle_meta_connection_data(int fd, short events, void *data) {
|
||||
|
@ -449,10 +449,10 @@ int main_loop(void) {
|
|||
struct event periodic_event;
|
||||
|
||||
timeout_set(&timeout_event, timeout_handler, &timeout_event);
|
||||
event_add(&timeout_event, &(struct timeval){pingtimeout, 0});
|
||||
event_add(&timeout_event, &(struct timeval){pingtimeout, rand() % 100000});
|
||||
|
||||
timeout_set(&periodic_event, periodic_handler, &periodic_event);
|
||||
event_add(&periodic_event, &(struct timeval){5, 0});
|
||||
event_add(&periodic_event, &(struct timeval){5, rand() % 100000});
|
||||
|
||||
#ifndef HAVE_MINGW
|
||||
struct event sighup_event;
|
||||
|
|
|
@ -151,7 +151,7 @@ static void send_mtu_probe_handler(int fd, short events, void *data) {
|
|||
}
|
||||
|
||||
end:
|
||||
event_add(&n->mtuevent, &(struct timeval){timeout, 0});
|
||||
event_add(&n->mtuevent, &(struct timeval){timeout, rand() % 100000});
|
||||
}
|
||||
|
||||
void send_mtu_probe(node_t *n) {
|
||||
|
|
|
@ -285,7 +285,7 @@ void regenerate_key(void) {
|
|||
timeout_set(&keyexpire_event, keyexpire_handler, NULL);
|
||||
}
|
||||
|
||||
event_add(&keyexpire_event, &(struct timeval){keylifetime, 0});
|
||||
event_add(&keyexpire_event, &(struct timeval){keylifetime, rand() % 100000});
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -282,7 +282,7 @@ void retry_outgoing(outgoing_t *outgoing) {
|
|||
outgoing->timeout = maxtimeout;
|
||||
|
||||
timeout_set(&outgoing->ev, retry_outgoing_handler, outgoing);
|
||||
event_add(&outgoing->ev, &(struct timeval){outgoing->timeout, 0});
|
||||
event_add(&outgoing->ev, &(struct timeval){outgoing->timeout, rand() % 100000});
|
||||
|
||||
logger(DEBUG_CONNECTIONS, LOG_NOTICE,
|
||||
"Trying to re-establish outgoing connection in %d seconds",
|
||||
|
|
|
@ -180,7 +180,7 @@ bool seen_request(const char *request) {
|
|||
new->request = xstrdup(request);
|
||||
new->firstseen = time(NULL);
|
||||
splay_insert(past_request_tree, new);
|
||||
event_add(&past_request_event, &(struct timeval){10, 0});
|
||||
event_add(&past_request_event, &(struct timeval){10, rand() % 100000});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ static void age_past_requests(int fd, short events, void *data) {
|
|||
deleted, left);
|
||||
|
||||
if(left)
|
||||
event_add(&past_request_event, &(struct timeval){10, 0});
|
||||
event_add(&past_request_event, &(struct timeval){10, rand() % 100000});
|
||||
}
|
||||
|
||||
void init_requests(void) {
|
||||
|
|
|
@ -209,7 +209,7 @@ static void age_subnets(int fd, short events, void *data) {
|
|||
}
|
||||
|
||||
if(left)
|
||||
event_add(&age_subnets_event, &(struct timeval){10, 0});
|
||||
event_add(&age_subnets_event, &(struct timeval){10, rand() % 100000});
|
||||
}
|
||||
|
||||
static void learn_mac(mac_t *address) {
|
||||
|
@ -238,7 +238,7 @@ static void learn_mac(mac_t *address) {
|
|||
|
||||
if(!timeout_initialized(&age_subnets_event))
|
||||
timeout_set(&age_subnets_event, age_subnets, NULL);
|
||||
event_add(&age_subnets_event, &(struct timeval){10, 0});
|
||||
event_add(&age_subnets_event, &(struct timeval){10, rand() % 100000});
|
||||
} else {
|
||||
if(subnet->expires)
|
||||
subnet->expires = time(NULL) + macexpire;
|
||||
|
|
Loading…
Reference in a new issue