- * Handle message from the backend.
- */
-void backend_response(IOCHAN i, int event)
-{
- association *assoc = (association *)iochan_getdata(i);
- request *req = request_head(&assoc->incoming);
- Z_APDU *res;
- int fd;
-
- yaz_log(YLOG_DEBUG, "backend_response");
- assert(assoc && req && req->state != REQUEST_IDLE);
- /* determine what it is we're waiting for */
- switch (req->apdu_request->which)
- {
- case Z_APDU_searchRequest:
- res = response_searchRequest(assoc, req, 0, &fd); break;
-#if 0
- case Z_APDU_presentRequest:
- res = response_presentRequest(assoc, req, 0, &fd); break;
- case Z_APDU_scanRequest:
- res = response_scanRequest(assoc, req, 0, &fd); break;
-#endif
- default:
- yaz_log(YLOG_FATAL, "Serious programmer's lapse or bug");
- abort();
- }
- if ((res && process_z_response(assoc, req, res) < 0) || fd < 0)
- {
- yaz_log(YLOG_WARN, "Fatal error when talking to backend");
- do_close(assoc, Z_Close_systemProblem, 0);
- iochan_destroy(i);
- return;
- }
- else if (!res) /* no result yet - try again later */
- {
- yaz_log(YLOG_DEBUG, " no result yet");
- iochan_setfd(i, fd); /* in case fd has changed */
- }
-}
-
-/*