The immediate fix is to prevent ZOOM_set_dset_error from removing
current task from connection. This, however, has been assumed in a
number of places so this fix is rather large unfortunately.
-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,
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 : "");
c, c->host_port ? c->host_port : "<>", dset, error,
addinfo ? addinfo : "",
addinfo2 ? addinfo2 : "");
- ZOOM_connection_remove_tasks(c);
if (task)
{
c->tasks = task->next;
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:
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);
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,
int ZOOM_test_reconnect(ZOOM_connection c);
ZOOM_record ZOOM_record_cache_lookup(ZOOM_resultset r, int pos,
-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)
{
NMEM nmem = odr_extract_mem(c->odr_in);
ZOOM_scanset scan;
if (!c->tasks || c->tasks->which != ZOOM_TASK_SCAN)
scan = c->tasks->u.scan.scan;
if (res->num_diagnostics > 0)
scan = c->tasks->u.scan.scan;
if (res->num_diagnostics > 0)
ZOOM_options_set_int(scan->options, "number", res->num_terms);
nmem_destroy(nmem);
ZOOM_options_set_int(scan->options, "number", res->num_terms);
nmem_destroy(nmem);
if (sr->which == Z_SRW_searchRetrieve_response)
*cret = handle_srw_response(c, sr->u.response);
else if (sr->which == Z_SRW_scan_response)
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);
if (sr->which == Z_SRW_searchRetrieve_response)
*cret = handle_srw_response(c, sr->u.response);
else if (sr->which == Z_SRW_scan_response)
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);
static void handle_Z3950_sort_response(ZOOM_connection c, Z_SortResponse *res)
{
if (res->diagnostics && res->num_diagnostics > 0)
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]);
response_diag(c, res->diagnostics[0]);
+ ZOOM_connection_remove_tasks(c);
+ }
}
static void handle_Z3950_scan_response(ZOOM_connection c, Z_ScanResponse *res)
}
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)
schema = c->tasks->u.search.schema;
if (sr && sr->which == Z_Records_NSD)
response_default_diag(c, sr->u.nonSurrogateDiagnostic);
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);
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);