From cd65f5a5853900e62ff5dd53796606cb9de70906 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 28 Jul 2015 14:55:25 +0200 Subject: [PATCH] Fix bytarget list not cleared for new search PAZ-1019 --- src/client.c | 19 +++++++++++++++---- src/session.c | 1 + test/test_limit_limitmap_34.res | 10 ---------- test/test_limit_limitmap_40.res | 10 ---------- 4 files changed, 16 insertions(+), 24 deletions(-) diff --git a/src/client.c b/src/client.c index 1c53733..5db3018 100644 --- a/src/client.c +++ b/src/client.c @@ -1518,6 +1518,9 @@ int client_parse_query(struct client *cl, const char *query, if (!ccl_map) return -3; + xfree(cl->cqlquery); + cl->cqlquery = 0; + w_ccl = wrbuf_alloc(); wrbuf_puts(w_ccl, query); @@ -1530,7 +1533,15 @@ int client_parse_query(struct client *cl, const char *query, if (apply_limit(cl, facet_limits, w_pqf, ccl_map, service)) { + client_set_state(cl, Client_Error); ccl_qual_rm(&ccl_map); + + wrbuf_destroy(w_ccl); + wrbuf_destroy(w_pqf); + + xfree(cl->pquery); + cl->pquery = 0; + return -2; } @@ -1551,6 +1562,10 @@ int client_parse_query(struct client *cl, const char *query, wrbuf_cstr(w_ccl)); wrbuf_destroy(w_ccl); wrbuf_destroy(w_pqf); + + xfree(cl->pquery); + cl->pquery = 0; + return -1; } wrbuf_destroy(w_ccl); @@ -1592,14 +1607,10 @@ int client_parse_query(struct client *cl, const char *query, } wrbuf_destroy(w_pqf); - xfree(cl->cqlquery); - cl->cqlquery = 0; - odr_out = odr_createmem(ODR_ENCODE); zquery = p_query_rpn(odr_out, cl->pquery); if (!zquery) { - session_log(se, YLOG_WARN, "Invalid PQF query for Client %s: %s", client_get_id(cl), cl->pquery); ret_value = -1; diff --git a/src/session.c b/src/session.c index b590001..b210f27 100644 --- a/src/session.c +++ b/src/session.c @@ -886,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; } diff --git a/test/test_limit_limitmap_34.res b/test/test_limit_limitmap_34.res index 3631c2d..8a59215 100644 --- a/test/test_limit_limitmap_34.res +++ b/test/test_limit_limitmap_34.res @@ -1,15 +1,5 @@ 0 - -Target-1 -ztest-db1 -10 -4 -4 -6 -Client_Idle -0 - \ No newline at end of file diff --git a/test/test_limit_limitmap_40.res b/test/test_limit_limitmap_40.res index 3631c2d..8a59215 100644 --- a/test/test_limit_limitmap_40.res +++ b/test/test_limit_limitmap_40.res @@ -1,15 +1,5 @@ 0 - -Target-1 -ztest-db1 -10 -4 -4 -6 -Client_Idle -0 - \ No newline at end of file -- 1.7.10.4