1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-04 16:58:42 +03:00

winbindd: keep client list sorted by access time

Keep client list sorted by last access time, newest
to oldest.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11397

Signed-off-by: Uri Simchoni <urisimchoni@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
This commit is contained in:
Uri Simchoni 2015-07-13 21:33:41 +03:00 committed by Jeremy Allison
parent f065100639
commit c10e24e1c7
2 changed files with 4 additions and 3 deletions

View File

@ -701,7 +701,8 @@ static void process_request(struct winbindd_cli_state *state)
state->cmd_name = "unknown request";
state->recv_fn = NULL;
state->last_access = time(NULL);
/* client is newest */
winbindd_promote_client(state);
/* Process command */
@ -930,8 +931,6 @@ static void new_connection(int listen_sock, bool privileged)
return;
}
state->last_access = time(NULL);
state->privileged = privileged;
req = wb_req_read_send(state, winbind_event_context(), state->sock,

View File

@ -1225,6 +1225,7 @@ winbindd_client_list_prev(struct winbindd_cli_state *cli)
void winbindd_add_client(struct winbindd_cli_state *cli)
{
cli->last_access = time(NULL);
DLIST_ADD(_client_list, cli);
_num_clients++;
}
@ -1241,6 +1242,7 @@ void winbindd_remove_client(struct winbindd_cli_state *cli)
void winbindd_promote_client(struct winbindd_cli_state *cli)
{
cli->last_access = time(NULL);
DLIST_PROMOTE(_client_list, cli);
}