Reformat the code using astyle.
[tinc] / src / event.c
index 9cd7d07..47adb18 100644 (file)
@@ -237,6 +237,8 @@ static void signal_handler(int signum) {
 }
 
 static void signalio_handler(void *data, int flags) {
+       (void)data;
+       (void)flags;
        unsigned char signum;
 
        if(read(pipefd[0], &signum, 1) != 1) {
@@ -348,6 +350,8 @@ bool event_loop(void) {
                        continue;
                }
 
+               unsigned int curgen = io_tree.generation;
+
                for splay_each(io_t, io, &io_tree) {
                        if(FD_ISSET(io->fd, &writable)) {
                                io->cb(io->data, IO_WRITE);
@@ -360,10 +364,12 @@ bool event_loop(void) {
                        /*
                           There are scenarios in which the callback will remove another io_t from the tree
                           (e.g. closing a double connection). Since splay_each does not support that, we
-                          need to exit the loop now. That's okay, since any remaining events will get picked
-                          up by the next select() call.
+                          need to exit the loop if that happens. That's okay, since any remaining events will
+                          get picked up by the next select() call.
                         */
-                       break;
+                       if(curgen != io_tree.generation) {
+                               break;
+                       }
                }
        }