Rename "event_t" to "tevent_t", along with associated functions.
[tinc] / src / net.c
index e834f92..9156147 100644 (file)
--- a/src/net.c
+++ b/src/net.c
@@ -29,7 +29,7 @@
 #include "conf.h"
 #include "connection.h"
 #include "device.h"
-#include "event.h"
+#include "tevent.h"
 #include "graph.h"
 #include "logger.h"
 #include "meta.h"
@@ -355,7 +355,7 @@ int main_loop(void)
        struct timeval tv;
        int r, maxfd;
        time_t last_ping_check, last_config_check, last_graph_dump;
-       event_t *event;
+       tevent_t *event;
 
        cp();
 
@@ -429,12 +429,7 @@ int main_loop(void)
 
                if(sigalrm) {
                        logger(LOG_INFO, _("Flushing event queue"));
-
-                       while(event_tree->head) {
-                               event = event_tree->head->data;
-                               event->handler(event->data);
-                               event_del(event);
-                       }
+                       flush_events();
                        sigalrm = false;
                }
 
@@ -463,7 +458,8 @@ int main_loop(void)
                                
                                if(c->outgoing) {
                                        free(c->outgoing->name);
-                                       freeaddrinfo(c->outgoing->ai);
+                                       if(c->outgoing->ai)
+                                               freeaddrinfo(c->outgoing->ai);
                                        free(c->outgoing);
                                        c->outgoing = NULL;
                                }