From: Adam Dickmeiss Date: Mon, 9 Jan 2012 11:11:58 +0000 (+0100) Subject: Skip incoming results from inactive clients X-Git-Tag: v1.6.8~10 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=6aed90d2cb69a71e6510475982d56933fb401606;p=pazpar2-moved-to-github.git Skip incoming results from inactive clients For search with a filter an existing clients that are active and becomes filtered out (inactive, but cached) Pazpar2 would still accept record ingestion .. This patch fixes that. We mark session=0 in clients that are not selected for a search (not active, but cached). --- diff --git a/src/session.c b/src/session.c index 425d6ca..f7f687d 100644 --- a/src/session.c +++ b/src/session.c @@ -523,13 +523,14 @@ static void select_targets_callback(struct session *se, { cl = client_create(db->database->id); client_set_database(cl, db); - client_set_session(cl, se); l = xmalloc(sizeof(*l)); l->client = cl; l->next = se->clients_cached; se->clients_cached = l; } + /* set session always. If may be 0 if client is not active */ + client_set_session(cl, se); l = xmalloc(sizeof(*l)); l->client = cl; @@ -550,6 +551,11 @@ static void session_reset_active_clients(struct session *se, while (l) { struct client_list *l_next = l->next; + + client_lock(l->client); + client_set_session(l->client, 0); /* mark client inactive */ + client_unlock(l->client); + xfree(l); l = l_next; }