X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=src%2Fclient.c;h=60553fd66f4c3d6a13354019807e176d50068600;hb=13b0cf66dbbc4e67a891c7a49aaa249dce264691;hp=723f8be6aafd2e12d4f44cf002e0077f3e131569;hpb=242cebf065b2b709b41b8c987927187141ff8ab5;p=pazpar2-moved-to-github.git diff --git a/src/client.c b/src/client.c index 723f8be..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); @@ -1151,7 +1150,9 @@ void client_set_connection(struct client *cl, struct connection *con) } else { + client_lock(cl); cl->connection = con; + client_unlock(cl); client_destroy(cl); } } @@ -1163,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) {