projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Try to process all pending events after select().
[tinc]
/
src
/
event.c
diff --git
a/src/event.c
b/src/event.c
index
9cd7d07
..
8c7de47
100644
(file)
--- a/
src/event.c
+++ b/
src/event.c
@@
-348,6
+348,8
@@
bool event_loop(void) {
continue;
}
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);
for splay_each(io_t, io, &io_tree) {
if(FD_ISSET(io->fd, &writable)) {
io->cb(io->data, IO_WRITE);
@@
-360,10
+362,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
/*
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;
+ }
}
}
}
}