From 039ccb42e498a92f877a3e91cada515ce08926fb Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Fri, 25 Sep 2009 11:08:22 -0400 Subject: Let backend respond while fetching large results Timers always come before fd events, wait 5 microseconds between processing operations so that tevent has a chance of cactching an fd event in between. This allows the backend to reply to pings even while processing very large ldap results (importanty especially during the first enumeration). --- server/providers/ldap/sdap_async.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'server') diff --git a/server/providers/ldap/sdap_async.c b/server/providers/ldap/sdap_async.c index 6ab88679f..165117483 100644 --- a/server/providers/ldap/sdap_async.c +++ b/server/providers/ldap/sdap_async.c @@ -298,7 +298,7 @@ static void sdap_process_message(struct tevent_context *ev, static void sdap_unlock_next_reply(struct sdap_op *op) { - struct timeval no_timeout = {0, 0}; + struct timeval tv; struct tevent_timer *te; struct sdap_msg *next_reply; @@ -311,7 +311,16 @@ static void sdap_unlock_next_reply(struct sdap_op *op) /* if there are still replies to parse, queue a new operation */ if (op->list) { - te = tevent_add_timer(op->ev, op, no_timeout, + /* use a very small timeout, so that fd operations have a chance to be + * served while processing a long reply */ + tv = tevent_timeval_current(); + + /* wait 5 microsecond */ + tv.tv_usec += 5; + tv.tv_sec += tv.tv_usec / 1000000; + tv.tv_usec = tv.tv_usec % 1000000; + + te = tevent_add_timer(op->ev, op, tv, sdap_process_next_reply, op); if (!te) { DEBUG(1, ("Failed to add critical timer for next reply!\n")); -- cgit