diff options
-rw-r--r-- | usr.sbin/ldapd/ldapd.h | 5 | ||||
-rw-r--r-- | usr.sbin/ldapd/ldape.c | 4 | ||||
-rw-r--r-- | usr.sbin/ldapd/namespace.c | 19 |
3 files changed, 17 insertions, 11 deletions
diff --git a/usr.sbin/ldapd/ldapd.h b/usr.sbin/ldapd/ldapd.h index 2aae21bea18..9cc40911d33 100644 --- a/usr.sbin/ldapd/ldapd.h +++ b/usr.sbin/ldapd/ldapd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ldapd.h,v 1.16 2010/07/01 20:09:34 martinh Exp $ */ +/* $OpenBSD: ldapd.h,v 1.17 2010/07/10 14:27:15 martinh Exp $ */ /* * Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se> @@ -395,7 +395,8 @@ int namespace_commit(struct namespace *ns); void namespace_abort(struct namespace *ns); int namespace_queue_request(struct namespace *ns, struct request *req); -void namespace_queue_schedule(struct namespace *ns); +void namespace_queue_schedule(struct namespace *ns, + unsigned int usec); void namespace_cancel_conn(struct conn *conn); int namespace_ber2db(struct namespace *ns, diff --git a/usr.sbin/ldapd/ldape.c b/usr.sbin/ldapd/ldape.c index 99492e96112..ca6cdf22f92 100644 --- a/usr.sbin/ldapd/ldape.c +++ b/usr.sbin/ldapd/ldape.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ldape.c,v 1.11 2010/07/01 20:09:34 martinh Exp $ */ +/* $OpenBSD: ldape.c,v 1.12 2010/07/10 14:27:15 martinh Exp $ */ /* * Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se> @@ -525,6 +525,6 @@ ldape_open_result(struct imsg *imsg) log_warnx("spurious open result"); close(imsg->fd); } else - namespace_queue_schedule(ns); + namespace_queue_schedule(ns, 0); } diff --git a/usr.sbin/ldapd/namespace.c b/usr.sbin/ldapd/namespace.c index 741ac5a2583..a67655b003a 100644 --- a/usr.sbin/ldapd/namespace.c +++ b/usr.sbin/ldapd/namespace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: namespace.c,v 1.9 2010/06/29 21:54:38 martinh Exp $ */ +/* $OpenBSD: namespace.c,v 1.10 2010/07/10 14:27:15 martinh Exp $ */ /* * Copyright (c) 2009, 2010 Martin Hedenfalk <martin@bzero.se> @@ -475,6 +475,10 @@ namespace_queue_request(struct namespace *ns, struct request *req) TAILQ_INSERT_TAIL(&ns->request_queue, req, next); ns->queued_requests++; + + if (!evtimer_pending(&ns->ev_queue, NULL)) + namespace_queue_schedule(ns, 250000); + return 0; } @@ -497,18 +501,19 @@ namespace_queue_replay(int fd, short event, void *data) req->replayed = 1; request_dispatch(req); ns->queued_requests--; + + if (!evtimer_pending(&ns->ev_queue, NULL)) + namespace_queue_schedule(ns, 0); } void -namespace_queue_schedule(struct namespace *ns) +namespace_queue_schedule(struct namespace *ns, unsigned int usec) { struct timeval tv; - if (!evtimer_pending(&ns->ev_queue, NULL)) { - tv.tv_sec = 0; - tv.tv_usec = 0; - evtimer_add(&ns->ev_queue, &tv); - } + tv.tv_sec = 0; + tv.tv_usec = usec; + evtimer_add(&ns->ev_queue, &tv); } /* Cancel all queued requests from the given connection. Drops matching |