X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=src%2Fsession.c;h=41447c64145b24c5d9901d0b99a9c0455b4c5cfc;hb=4ae1e0582f66acaec33dca2c3b023d47d7f431af;hp=c60741853bb270d578e1afd023ec69a7d1dacbf6;hpb=8b81889f868b613dcc8c7a37d9522228f47cbccd;p=pazpar2-moved-to-github.git diff --git a/src/session.c b/src/session.c index c607418..41447c6 100644 --- a/src/session.c +++ b/src/session.c @@ -228,18 +228,27 @@ static void session_add_id_facet(struct session *s, struct client *cl, } +// Look up a facet term, and return matching id +// If facet type not found, returns 0 +// If facet type found, but no matching term, returns "" const char *session_lookup_id_facet(struct session *s, struct client *cl, const char *type, const char *term) { + char *retval = 0; struct facet_id *t = s->facet_id_list; - for (; t; t = t->next) - if (!strcmp(client_get_id(cl), t->client_id) && - !strcmp(t->type, type) && !strcmp(t->term, term)) + for (; t; t = t->next) + { + if (!strcmp(client_get_id(cl), t->client_id) && !strcmp(t->type, type) ) { - return t->id; + retval = ""; + if ( !strcmp(t->term, term)) + { + return t->id; + } } - return 0; + } + return retval; } void add_facet(struct session *s, const char *type, const char *value, int count, struct client *cl) @@ -561,7 +570,6 @@ static void select_targets_callback(struct session *se, 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)); @@ -610,6 +618,7 @@ static void session_remove_cached_clients(struct session *se) client_lock(l->client); client_set_session(l->client, 0); client_set_database(l->client, 0); + client_mark_dead(l->client); client_unlock(l->client); client_destroy(l->client); xfree(l); @@ -877,6 +886,7 @@ enum pazpar2_error_code session_search(struct session *se, *addinfo = "limit"; session_leave(se, "session_search"); se->clients_starting = 0; + session_reset_active_clients(se, 0); return PAZPAR2_MALFORMED_PARAMETER_VALUE; }