Change flush_events() to expire_events().

The former function made a totally bogus shallow copy of the event_tree, called
the handler of each event and then deleted the whole tree.  This should've
caused tinc to crash when an ALARM signal was sent more than once, but for some
reason it didn't. It also behaved incorrectly when a handler added a new event.

The new function just moves the expiration time of all events to the past.
This commit is contained in:
Guus Sliepen 2009-01-19 22:50:05 +01:00
parent a39a9506cd
commit 116065afe3
3 changed files with 25 additions and 20 deletions

View file

@ -423,18 +423,17 @@ int main_loop(void)
}
}
if(sigalrm) {
logger(LOG_INFO, _("Flushing event queue"));
expire_events();
sigalrm = false;
}
while((event = get_expired_event())) {
event->handler(event->data);
free_event(event);
}
if(sigalrm) {
logger(LOG_INFO, _("Flushing event queue"));
flush_events();
sigalrm = false;
}
if(sighup) {
connection_t *c;
avl_node_t *node;