summaryrefslogtreecommitdiff
path: root/source3/rpc_server/lsasd.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2011-08-16 12:01:02 -0400
committerSimo Sorce <idra@samba.org>2011-08-21 09:05:05 -0400
commit89dde6b7fce3342c828f166e7d76bf4656939ee4 (patch)
treedff74ba37423b69e5e3c205fdeeeee50078bf0f4 /source3/rpc_server/lsasd.c
parentf07f5c51000ed9403134e8f4eb3318ec6d572342 (diff)
downloadsamba-89dde6b7fce3342c828f166e7d76bf4656939ee4.tar.gz
s3-lsasd: User new prefork helpers to simplify code.
Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Simo Sorce <idra@samba.org>
Diffstat (limited to 'source3/rpc_server/lsasd.c')
-rw-r--r--source3/rpc_server/lsasd.c30
1 files changed, 3 insertions, 27 deletions
diff --git a/source3/rpc_server/lsasd.c b/source3/rpc_server/lsasd.c
index 043165fe136..c53eb5f3797 100644
--- a/source3/rpc_server/lsasd.c
+++ b/source3/rpc_server/lsasd.c
@@ -292,8 +292,6 @@ struct lsasd_children_data {
struct pf_worker_data *pf;
int listen_fd_size;
int *listen_fds;
-
- bool listening;
};
static void lsasd_next_client(void *pvt);
@@ -324,7 +322,6 @@ static int lsasd_children_main(struct tevent_context *ev_ctx,
data->msg_ctx = msg_ctx;
data->listen_fd_size = listen_fd_size;
data->listen_fds = listen_fds;
- data->listening = false;
/* loop until it is time to exit */
while (pf->status != PF_WORKER_EXITING) {
@@ -348,13 +345,7 @@ static void lsasd_client_terminated(void *pvt)
data = talloc_get_type_abort(pvt, struct lsasd_children_data);
- if (data->pf->num_clients) {
- data->pf->num_clients--;
- } else {
- DEBUG(2, ("Invalid num clients, aborting!\n"));
- data->pf->status = PF_WORKER_EXITING;
- return;
- }
+ pfh_client_terminated(data->pf);
lsasd_next_client(pvt);
}
@@ -373,20 +364,9 @@ static void lsasd_next_client(void *pvt)
data = talloc_get_type_abort(pvt, struct lsasd_children_data);
- if (data->pf->num_clients == 0) {
- data->pf->status = PF_WORKER_ALIVE;
- }
-
- if (data->pf->cmds == PF_SRV_MSG_EXIT) {
- DEBUG(2, ("Parent process commands we terminate!\n"));
- return;
- }
-
- if (data->listening ||
- data->pf->num_clients >= data->pf->allowed_clients) {
+ if (!pfh_child_allowed_to_accept(data->pf)) {
/* nothing to do for now we are already listening
- * or reached the number of clients we are allowed
- * to handle in parallel */
+ * or we are not allowed to listen further */
return;
}
@@ -408,8 +388,6 @@ static void lsasd_next_client(void *pvt)
return;
}
tevent_req_set_callback(req, lsasd_handle_client, next);
-
- data->listening = true;
}
static void lsasd_handle_client(struct tevent_req *req)
@@ -439,8 +417,6 @@ static void lsasd_handle_client(struct tevent_req *req)
/* this will free the request too */
talloc_free(client);
- /* we are done listening */
- data->listening = false;
if (rc != 0) {
DEBUG(6, ("No client connection was available after all!\n"));