X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Ffilter_multi.cpp;h=9c1233f3a67fcbe6d301f7721805d6e89e78af20;hb=ff4921cc3b96c81d2704417b311f217bf3663a4d;hp=33367e727569fcaef68e0fff0e2505f4eabba9b9;hpb=5d4b02d90ec640b97faac0b8e0629c84dd333d2a;p=metaproxy-moved-to-github.git diff --git a/src/filter_multi.cpp b/src/filter_multi.cpp index 33367e7..9c1233f 100644 --- a/src/filter_multi.cpp +++ b/src/filter_multi.cpp @@ -1,5 +1,5 @@ /* This file is part of Metaproxy. - Copyright (C) 2005-2009 Index Data + Copyright (C) 2005-2010 Index Data Metaproxy is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -20,15 +20,15 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include "config.hpp" -#include "filter.hpp" -#include "package.hpp" +#include +#include #include #include #include #include -#include "util.hpp" +#include #include "filter_multi.hpp" #include @@ -461,8 +461,6 @@ void yf::Multi::Frontend::init(mp::Package &package, Z_GDU *gdu) bit = m_backend_list.erase(bit); continue; } - no_succeeded++; - Z_GDU *gdu = p->response().get(); if (gdu && gdu->which == Z_GDU_Z3950 && gdu->u.z3950->which == Z_APDU_initResponse) @@ -481,28 +479,30 @@ void yf::Multi::Frontend::init(mp::Package &package, Z_GDU *gdu) for (i = 0; i <= Z_ProtocolVersion_3; i++) if (!ODR_MASK_GET(b_resp->protocolVersion, i)) ODR_MASK_CLEAR(f_resp->protocolVersion, i); - // reject if any of the backends reject - if (!*b_resp->result) - *f_resp->result = 0; + if (*b_resp->result) + no_succeeded++; + else + no_failed++; } else - { - // if any target does not return init return that (close or - // similar ) - package.response() = p->response(); - return; - } + no_failed++; bit++; } if (m_p->m_hide_unavailable) { if (no_succeeded == 0) + { + *f_resp->result = 0; package.session().close(); + } } else { if (no_failed) + { + *f_resp->result = 0; package.session().close(); + } } package.response() = f_apdu; } @@ -766,6 +766,14 @@ void yf::Multi::Frontend::present(mp::Package &package, Z_APDU *apdu_req) f_resp->records = z_records_diag; *f_resp->presentStatus = Z_PresentStatus_failure; } + else if (number < 0 || (size_t) number > jobs.size()) + { + f_apdu = + odr.create_presentResponse( + apdu_req, + YAZ_BIB1_PRESENT_REQUEST_OUT_OF_RANGE, + 0); + } else { f_resp->records = (Z_Records *) odr_malloc(odr, sizeof(Z_Records)); @@ -976,7 +984,7 @@ void yf::Multi::Frontend::scan2(mp::Package &package, Z_APDU *apdu_req) { ScanTermInfo my; - int *occur = ent->u.termInfo->globalOccurrences; + Odr_int *occur = ent->u.termInfo->globalOccurrences; my.m_count = occur ? *occur : 0; if (ent->u.termInfo->term->which == Z_Term_general) @@ -1017,7 +1025,7 @@ void yf::Multi::Frontend::scan2(mp::Package &package, Z_APDU *apdu_req) { ScanTermInfo my; - int *occur = ent->u.termInfo->globalOccurrences; + Odr_int *occur = ent->u.termInfo->globalOccurrences; my.m_count = occur ? *occur : 0; if (ent->u.termInfo->term->which == Z_Term_general)