summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-05-25 20:28:38 +0200
committerVolker Lendecke <vl@samba.org>2009-06-14 11:25:48 +0200
commiteaaaea01e061927d16eca1c7472de108bf0edce3 (patch)
tree7bd2562e4ec1ed0ca6293eb4241c047cb6a7631a /source3
parente4fb2b9408a3a022f8e02442e1f2d0b6de04ba20 (diff)
downloadsamba-eaaaea01e061927d16eca1c7472de108bf0edce3.tar.gz
samba-eaaaea01e061927d16eca1c7472de108bf0edce3.tar.bz2
samba-eaaaea01e061927d16eca1c7472de108bf0edce3.zip
Avoid scanning the client list when a client exits
Diffstat (limited to 'source3')
-rw-r--r--source3/winbindd/winbindd.c25
-rw-r--r--source3/winbindd/winbindd.h1
2 files changed, 6 insertions, 20 deletions
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index ca2377131d..cc2a7cb2a7 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);
diff --git a/source3/winbindd/winbindd.h b/source3/winbindd/winbindd.h
index ae688e251c..419ab50792 100644
--- a/source3/winbindd/winbindd.h
+++ b/source3/winbindd/winbindd.h
@@ -51,7 +51,6 @@ struct winbindd_cli_state {
struct winbindd_cli_state *prev, *next; /* Linked list pointers */
int sock; /* Open socket from client */
pid_t pid; /* pid of client */
- bool finished; /* Can delete from list */
bool write_extra_data; /* Write extra_data field */
time_t last_access; /* Time of last access (read or write) */
bool privileged; /* Is the client 'privileged' */