X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Fclient.c;h=fbda5cd8eddfb3e4aaffeaa5b84693230eed8433;hb=cea5d06318c86c9652cad5c4fefa39fa2e9745ac;hp=9af8c2bd3834ce34a8ac2c0e3f62cf19c4315b8d;hpb=62747ed9d1e5d4e2fb63f9072c54d30200a99e21;p=pazpar2-moved-to-github.git diff --git a/src/client.c b/src/client.c index 9af8c2b..fbda5cd 100644 --- a/src/client.c +++ b/src/client.c @@ -921,22 +921,29 @@ int client_start_search(struct client *cl) const char *opt_preferred = session_setting_oneval(sdb, PZ_PREFERRED); const char *extra_args = session_setting_oneval(sdb, PZ_EXTRA_ARGS); const char *opt_present_chunk = session_setting_oneval(sdb, PZ_PRESENT_CHUNK); + const char *opt_timeout = session_setting_oneval(sdb, PZ_TIMEOUT); ZOOM_query query; char maxrecs_str[24], startrecs_str[24], present_chunk_str[24]; struct timeval tval; int present_chunk = 20; // Default chunk size int rc_prep_connection; + int operation_timeout = se->service->z3950_operation_timeout; + cl->diagnostic = 0; + cl->record_failures = cl->ingest_failures = cl->filtered = 0; yaz_gettimeofday(&tval); tval.tv_sec += 5; + if (opt_timeout && *opt_timeout) + operation_timeout = atoi(opt_timeout); + if (opt_present_chunk && strcmp(opt_present_chunk,"")) { present_chunk = atoi(opt_present_chunk); yaz_log(YLOG_DEBUG, "Present chunk set to %d", present_chunk); } rc_prep_connection = - client_prep_connection(cl, se->service->z3950_operation_timeout, + client_prep_connection(cl, operation_timeout, se->service->z3950_session_timeout, se->service->server->iochan_man, &tval); @@ -961,9 +968,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 +1169,32 @@ void client_disconnect(struct client *cl) client_set_connection(cl, 0); } +void client_mark_dead(struct client *cl) +{ + if (cl->connection) + connection_mark_dead(cl->connection); +} + +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) {