X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fclient.c;h=60553fd66f4c3d6a13354019807e176d50068600;hb=7a8e8e37ed254a29f5085855e6d03fe4ff7573e9;hp=9af8c2bd3834ce34a8ac2c0e3f62cf19c4315b8d;hpb=1aa3d495d48e9f30c1be3dbca4c790d518438d77;p=pazpar2-moved-to-github.git diff --git a/src/client.c b/src/client.c index 9af8c2b..60553fd 100644 --- a/src/client.c +++ b/src/client.c @@ -927,6 +927,8 @@ int client_start_search(struct client *cl) int present_chunk = 20; // Default chunk size int rc_prep_connection; + cl->diagnostic = 0; + cl->record_failures = cl->ingest_failures = cl->filtered = 0; yaz_gettimeofday(&tval); tval.tv_sec += 5; @@ -961,9 +963,6 @@ int client_start_search(struct client *cl) session_log(se, YLOG_LOG, "%s: new search", client_get_id(cl)); - cl->diagnostic = 0; - cl->record_failures = cl->ingest_failures = cl->filtered = 0; - client_destroy_xdoc(cl); client_init_xdoc(cl); @@ -1165,6 +1164,26 @@ void client_disconnect(struct client *cl) client_set_connection(cl, 0); } +void client_stop(struct client *cl) +{ + client_lock(cl); + if (cl->state == Client_Working || cl->state == Client_Connecting) + { + yaz_log(YLOG_LOG, "client_stop: %s release", client_get_id(cl)); + if (cl->connection) + { + connection_release2(cl->connection); + assert(cl->ref_count > 1); + cl->ref_count--; + cl->connection = 0; + } + cl->state = Client_Disconnected; + } + else + yaz_log(YLOG_LOG, "client_stop: %s ignore", client_get_id(cl)); + client_unlock(cl); +} + // Initialize CCL map for a target static CCL_bibset prepare_cclmap(struct client *cl, CCL_bibset base_bibset) {