}
}
-void ZOOM_connection_remove_tasks(ZOOM_connection c);
static zoom_ret send_HTTP_redirect(ZOOM_connection c, const char *uri);
void ZOOM_set_dset_error(ZOOM_connection c, int error,
c, c->host_port ? c->host_port : "<>", dset, error,
addinfo ? addinfo : "",
addinfo2 ? addinfo2 : "");
- ZOOM_connection_remove_tasks(c);
}
}
if (task)
{
c->tasks = task->next;
+ yaz_log(YLOG_LOG, "remove task p=%d type=%d next=%p",
+ task, (int) task->which, c->tasks);
switch (task->which)
{
case ZOOM_TASK_SEARCH:
ZOOM_task ZOOM_connection_add_task(ZOOM_connection c, int which);
void ZOOM_connection_remove_task(ZOOM_connection c);
+void ZOOM_connection_remove_tasks(ZOOM_connection c);
int ZOOM_test_reconnect(ZOOM_connection c);
ZOOM_record ZOOM_record_cache_lookup(ZOOM_resultset r, int pos,
#endif
#if YAZ_HAVE_XML2
-static void handle_srw_scan_response(ZOOM_connection c,
- Z_SRW_scanResponse *res)
+static zoom_ret handle_srw_scan_response(ZOOM_connection c,
+ Z_SRW_scanResponse *res)
{
NMEM nmem = odr_extract_mem(c->odr_in);
ZOOM_scanset scan;
if (!c->tasks || c->tasks->which != ZOOM_TASK_SCAN)
- return;
+ return zoom_complete;
scan = c->tasks->u.scan.scan;
if (res->num_diagnostics > 0)
ZOOM_options_set_int(scan->options, "number", res->num_terms);
nmem_destroy(nmem);
+ return zoom_complete;
}
#endif
if (sr->which == Z_SRW_searchRetrieve_response)
*cret = handle_srw_response(c, sr->u.response);
else if (sr->which == Z_SRW_scan_response)
- handle_srw_scan_response(c, sr->u.scan_response);
+ *cret = handle_srw_scan_response(c, sr->u.scan_response);
}
}
else
if (sr->which == Z_SRW_searchRetrieve_response)
*cret = handle_srw_response(c, sr->u.response);
else if (sr->which == Z_SRW_scan_response)
- handle_srw_scan_response(c, sr->u.scan_response);
+ *cret = handle_srw_scan_response(c, sr->u.scan_response);
else
ret = -1;
}
static void handle_Z3950_sort_response(ZOOM_connection c, Z_SortResponse *res)
{
if (res->diagnostics && res->num_diagnostics > 0)
+ {
response_diag(c, res->diagnostics[0]);
+ ZOOM_connection_remove_tasks(c);
+ }
}
static void handle_Z3950_scan_response(ZOOM_connection c, Z_ScanResponse *res)
schema = c->tasks->u.search.schema;
if (sr && sr->which == Z_Records_NSD)
+ {
response_default_diag(c, sr->u.nonSurrogateDiagnostic);
+ ZOOM_connection_remove_tasks(c);
+ }
else if (sr && sr->which == Z_Records_multipleNSD)
{
if (sr->u.multipleNonSurDiagnostics->num_diagRecs >= 1)
response_diag(c, sr->u.multipleNonSurDiagnostics->diagRecs[0]);
else
ZOOM_set_error(c, ZOOM_ERROR_DECODE, 0);
+ ZOOM_connection_remove_tasks(c);
}
else
{