]> git.meshlink.io Git - meshlink/blobdiff - src/net.c
A couple missed tevent things.
[meshlink] / src / net.c
index 81a0d894daaf8f818a8139c72404be5f40a7ea5f..e9c7020a488cf3ac83b0843b845118165e894e4f 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();
 
@@ -422,19 +422,14 @@ int main_loop(void)
                }
 
 
-               while((event = get_expired_event())) {
+               while((event = get_expired_tevent())) {
                        event->handler(event->data);
-                       free(event);
+                       free_tevent(event);
                }
 
                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_tevents();
                        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;
                                }