Displaying 5 results from an estimated 5 matches for "splay_each".
2018 Feb 27
2
tinc 1.1: missing PONG
...nt.c
@@ -387,71 +389,89 @@ bool event_loop(void) {
Note that technically FD_CLOSE has the same problem, but it's okay because user code does not rely on
this event being fired again if ignored.
*/
- io_t *writeable_io = NULL;
+ unsigned int curgen = io_tree.generation;
- for splay_each(io_t, io, &io_tree)
+ for splay_each(io_t, io, &io_tree) {
if(io->flags & IO_WRITE && send(io->fd, NULL, 0, 0) == 0) {
- writeable_io = io;
- break;
+ io->cb(io->data, IO_WRITE);
+
+ if(curgen != io_tree.generation) {
+ break;
+ }
}
+ }...
2018 Feb 27
1
tinc 1.1: missing PONG
...Moving the most recently
> > accessed event to the end gives the others a chance to proceed.
>
> But it doesn't order them by most recently accessed. It's a
> deterministic order that doesn't change except when io_add() or io_del()
> is called. Or put in another way: splay_each(io_t, io, &io_tree) goes
> through the nodes of the io_tree in the order determined by
> io_compare().
Unlike the POSIX event code, the Windows version calls splay_search()
to map the event to an io_t. The call to splay_search() will splay
the tree which changes the order the next time...
2018 Feb 26
2
tinc 1.1: missing PONG
On Mon, 26 Feb 2018 23:01:29 +0100, Guus Sliepen wrote:
> The problem is not the order of the events, the problem is that in the
> Windows version of the event loop, we only handle one event in each loop
> iteration. The select() loop handles all events that have accumulated so
> far, so regardless of the order it handles them, it never starves fd. At
> least, that was what I
2018 Feb 27
0
tinc 1.1: missing PONG
...WaitForMultipleEvents(). Moving the most recently
> accessed event to the end gives the others a chance to proceed.
But it doesn't order them by most recently accessed. It's a
deterministic order that doesn't change except when io_add() or io_del()
is called. Or put in another way: splay_each(io_t, io, &io_tree) goes
through the nodes of the io_tree in the order determined by
io_compare().
--
Met vriendelijke groet / with kind regards,
Guus Sliepen <guus at tinc-vpn.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Ty...
2018 Feb 23
2
tinc 1.1: missing PONG
...l event_loop(void) {
}
WSAEVENT *events = xmalloc(event_count * sizeof(*events));
- DWORD event_index = 0;
+ DWORD event_index = event_count;
+ /*
+ * Fill events[] in reverse order. Otherwise we may starve
+ * events other than the TAP, which is usually at the head.
+ */
for splay_each(io_t, io, &io_tree) {
- events[event_index] = io->event;
- event_index++;
+ events[--event_index] = io->event;
}
DWORD result = WSAWaitForMultipleEvents(event_count, events, FALSE, timeout_ms, FALSE);