Skip to content

Commit

Permalink
Let backend respond while fetching large results
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
simo5 authored and sgallagher committed Sep 25, 2009
1 parent 9e82101 commit 039ccb4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions server/providers/ldap/sdap_async.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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"));
Expand Down

0 comments on commit 039ccb4

Please sign in to comment.