gsliepen/tinc — pull request #30 by dechamps (2014-07-04 23:29:33+00:00)
Title: Fix tinc event loop reentrancy from timeout handlers

Commit 611217c96ec684799882cf330f40a0936131b6b5 introduced a regression because it accidentally reordered the timeout handler calls and the fdset setup code. This means that any `io_add()`, `io_del()` or `io_set()` calls in timeout handlers would be ignored in the current event loop iteration, resulting in erratic behavior.

The most visible symptom is when a metaconnection timeout occurs and the connection is closed; the timeout handler closes the socket but it still ends up in the select() call, typically resulting in the following crash:

Error while waiting for input: Bad file descriptor