summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2013-02-21 15:44:30 +0100
committerJeremy Allison <jra@samba.org>2013-03-01 12:00:06 -0800
commit8764ec80bbcba93e862c069766c00944e5187ed5 (patch)
tree7dc47b6e4ff2316a87596d075dd5fe5288cd4a1a
parentb31767bf27bafd3ae20ba3f26dd5001051b9f2b6 (diff)
downloadsamba-8764ec80bbcba93e862c069766c00944e5187ed5.tar.gz
samba-8764ec80bbcba93e862c069766c00944e5187ed5.tar.bz2
samba-8764ec80bbcba93e862c069766c00944e5187ed5.zip
tevent: use DLIST_DEMOTE() before calling on fde handler after select() and poll()
This makes sure we don't preferr events which are at the beginning of the list. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r--lib/tevent/tevent_poll.c1
-rw-r--r--lib/tevent/tevent_select.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/lib/tevent/tevent_poll.c b/lib/tevent/tevent_poll.c
index aa4c50c0c5..0175cae531 100644
--- a/lib/tevent/tevent_poll.c
+++ b/lib/tevent/tevent_poll.c
@@ -601,6 +601,7 @@ static int poll_event_loop_poll(struct tevent_context *ev,
*/
flags &= fde->flags;
if (flags != 0) {
+ DLIST_DEMOTE(ev->fd_events, fde, struct tevent_fd);
fde->handler(ev, fde, flags, fde->private_data);
return 0;
}
diff --git a/lib/tevent/tevent_select.c b/lib/tevent/tevent_select.c
index d8aeaa7c55..5e26569276 100644
--- a/lib/tevent/tevent_select.c
+++ b/lib/tevent/tevent_select.c
@@ -221,6 +221,7 @@ static int select_event_loop_select(struct select_event_context *select_ev, stru
flags |= TEVENT_FD_WRITE;
}
if (flags) {
+ DLIST_DEMOTE(select_ev->ev->fd_events, fde, struct tevent_fd);
fde->handler(select_ev->ev, fde, flags, fde->private_data);
break;
}