X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=server%2Fseshigh.c;h=5ad762fd575fb4ffed8a49fab1bdea61df7e523d;hb=2156e17830e0e3ba739800d6616fa045b0fe5565;hp=24a835dbb02b401dc71a39f008c1cae6f6578bf7;hpb=f94999cca65bd3464c1c6db8b5046e0a010b0c7f;p=yaz-moved-to-github.git diff --git a/server/seshigh.c b/server/seshigh.c index 24a835d..5ad762f 100644 --- a/server/seshigh.c +++ b/server/seshigh.c @@ -4,7 +4,13 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: seshigh.c,v $ - * Revision 1.74 1998-03-31 15:13:20 adam + * Revision 1.76 1998-05-27 16:57:07 adam + * Support for surrogate diagnostic records added for bend_fetch. + * + * Revision 1.75 1998/05/18 10:13:07 adam + * Fixed call to es_request handler - extra argument was passed. + * + * Revision 1.74 1998/03/31 15:13:20 adam * Development towards compiled ASN.1. * * Revision 1.73 1998/03/31 11:07:45 adam @@ -679,13 +685,13 @@ static int process_response(association *assoc, request *req, Z_APDU *res) req->response = odr_getbuf(assoc->encode, &req->len_response, &req->size_response); odr_setbuf(assoc->encode, 0, 0, 0); /* don'txfree if we abort later */ - odr_reset(assoc->encode); if (assoc->print && !z_APDU(assoc->print, &res, 0)) { logf(LOG_WARN, "ODR print error: %s", odr_errmsg(odr_geterror(assoc->print))); odr_reset(assoc->print); } + odr_reset(assoc->encode); req->state = REQUEST_IDLE; request_enq(&assoc->outgoing, req); /* turn the work over to the ir_session handler */ @@ -885,7 +891,7 @@ static Z_Records *diagrec(association *assoc, int error, char *addinfo) * surrogate diagnostic. */ static Z_NamePlusRecord *surrogatediagrec(association *assoc, char *dbname, - int error, char *addinfo) + int error, char *addinfo) { int oid[OID_SIZE]; Z_NamePlusRecord *rec = (Z_NamePlusRecord *)odr_malloc (assoc->encode, sizeof(*rec)); @@ -980,7 +986,7 @@ static Z_Records *pack_records(association *a, char *setname, int start, bend_fetchresult *fres; Z_NamePlusRecord *thisrec; Z_DatabaseRecord *thisext; - int this_length; + int this_length = 0; /* * we get the number of bytes allocated on the stream before any @@ -993,6 +999,7 @@ static Z_Records *pack_records(association *a, char *setname, int start, freq.comp = comp; freq.format = format; freq.stream = a->encode; + freq.surrogate_flag = 0; if (!(fres = bend_fetch(a->backend, &freq, 0))) { *pres = Z_PRES_FAILURE; @@ -1002,8 +1009,17 @@ static Z_Records *pack_records(association *a, char *setname, int start, or only pertaining to current record */ if (fres->errcode) { - *pres = Z_PRES_FAILURE; - return diagrec(a, fres->errcode, fres->errstring); + if (!freq.surrogate_flag) + { + *pres = Z_PRES_FAILURE; + return diagrec(a, fres->errcode, fres->errstring); + } + reclist->records[reclist->num_records] = + surrogatediagrec(a, fres->basename, fres->errcode, + fres->errstring); + reclist->num_records++; + *next = fres->last_in_set ? 0 : recno + 1; + continue; } if (fres->len >= 0) this_length = fres->len; @@ -1046,6 +1062,7 @@ static Z_Records *pack_records(association *a, char *setname, int start, continue; } } + if (!(thisrec = (Z_NamePlusRecord *)odr_malloc(a->encode, sizeof(*thisrec)))) return 0; if (!(thisrec->databaseName = (char *)odr_malloc(a->encode, @@ -1654,11 +1671,12 @@ static Z_APDU *process_ESRequest(association *assoc, request *reqb, int *fd) esrequest.stream = assoc->encode; esrequest.errcode = 0; esrequest.errstring = NULL; - esrequest.request = reqb; - esrequest.association = assoc; - - (*assoc->bend_esrequest)(assoc->backend, &esrequest, fd); - + esrequest.request = reqb; + esrequest.association = assoc; + + ((int (*)(void *, bend_esrequest_rr *))(*assoc->bend_esrequest))(assoc->backend, + &esrequest); + /* If the response is being delayed, return NULL */ if (esrequest.request == NULL) return(NULL);