diff options
author | Volker Lendecke <vl@samba.org> | 2009-05-25 20:28:38 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-06-14 11:25:48 +0200 |
commit | eaaaea01e061927d16eca1c7472de108bf0edce3 (patch) | |
tree | 7bd2562e4ec1ed0ca6293eb4241c047cb6a7631a /source3/winbindd/winbindd.c | |
parent | e4fb2b9408a3a022f8e02442e1f2d0b6de04ba20 (diff) | |
download | samba-eaaaea01e061927d16eca1c7472de108bf0edce3.tar.gz samba-eaaaea01e061927d16eca1c7472de108bf0edce3.tar.xz samba-eaaaea01e061927d16eca1c7472de108bf0edce3.zip |
Avoid scanning the client list when a client exits
Diffstat (limited to 'source3/winbindd/winbindd.c')
-rw-r--r-- | source3/winbindd/winbindd.c | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index ca2377131de..cc2a7cb2a7b 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -29,6 +29,8 @@ #undef DBGC_CLASS #define DBGC_CLASS DBGC_WINBIND +static void remove_client(struct winbindd_cli_state *state); + static bool opt_nocache = False; static bool interactive = False; @@ -628,7 +630,7 @@ static void request_finished(struct winbindd_cli_state *state) state->out_queue, state->sock, &state->response); if (req == NULL) { - state->finished = true; + remove_client(state); return; } tevent_req_set_callback(req, winbind_client_response_written, state); @@ -646,7 +648,7 @@ static void winbind_client_response_written(struct tevent_req *req) if (ret == -1) { DEBUG(2, ("Could not write response to client: %s\n", strerror(err))); - state->finished = true; + remove_client(state); return; } @@ -655,7 +657,7 @@ static void winbind_client_response_written(struct tevent_req *req) req = wb_req_read_send(state, winbind_event_context(), state->sock, WINBINDD_MAX_EXTRA_DATA); if (req == NULL) { - state->finished = true; + remove_client(state); return; } tevent_req_set_callback(req, winbind_client_request_read, state); @@ -744,7 +746,7 @@ static void winbind_client_request_read(struct tevent_req *req) if (ret == -1) { DEBUG(2, ("Could not read client request: %s\n", strerror(err))); - state->finished = true; + remove_client(state); return; } process_request(state); @@ -1265,27 +1267,12 @@ int main(int argc, char **argv, char **envp) TALLOC_FREE(frame); /* Loop waiting for requests */ while (1) { - struct winbindd_cli_state *state; - frame = talloc_stackframe(); /* refresh the trusted domain cache */ rescan_trusted_domains(); - /* Dispose of client connection if it is marked as - finished */ - state = winbindd_client_list(); - while (state) { - struct winbindd_cli_state *next = state->next; - - if (state->finished) { - remove_client(state); - } - - state = next; - } - process_loop(); TALLOC_FREE(frame); |