X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;ds=sidebyside;f=src%2Fyaz-proxy.cpp;h=ed0d095c91d3db38c55b22bb78723ee6da8f0d1a;hb=1b73b30c27af204acc67f4d2deae1765fd3caf21;hp=4dbcc43056fee27a0ee7ed0b026b2fb57263ddb8;hpb=21ae3b472a54629d9c231e6b65ef560f5b882666;p=yazpp-moved-to-github.git diff --git a/src/yaz-proxy.cpp b/src/yaz-proxy.cpp index 4dbcc43..ed0d095 100644 --- a/src/yaz-proxy.cpp +++ b/src/yaz-proxy.cpp @@ -2,7 +2,7 @@ * Copyright (c) 1998-2004, Index Data. * See the file LICENSE for details. * - * $Id: yaz-proxy.cpp,v 1.87 2004-01-12 21:02:42 adam Exp $ + * $Id: yaz-proxy.cpp,v 1.89 2004-01-14 12:14:13 adam Exp $ */ #include @@ -606,7 +606,8 @@ void Yaz_Proxy::convert_xsl(Z_NamePlusRecordList *p) xmlChar *out_buf; int out_len; - xmlDocDumpMemory (res, &out_buf, &out_len); + xmlDocDumpFormatMemory (res, &out_buf, &out_len, 1); + p->records[i]->u.databaseRecord = z_ext_record(odr_encode(), VAL_TEXT_XML, (char*) out_buf, out_len); @@ -898,7 +899,7 @@ int Yaz_Proxy::send_PDU_convert(Z_APDU *apdu, int *len) { send_to_srw_client_ok(0, res->records, 1); } - else if (m_s2z_present_apdu) + else if (m_s2z_present_apdu && m_s2z_hit_count > 0) { // adjust Z_PresentRequest *pr = m_s2z_present_apdu->u.presentRequest; @@ -914,6 +915,7 @@ int Yaz_Proxy::send_PDU_convert(Z_APDU *apdu, int *len) } else { + m_s2z_present_apdu = 0; send_to_srw_client_ok(m_s2z_hit_count, res->records, 1); } } @@ -2182,6 +2184,12 @@ void Yaz_Proxy::timeoutNotify() } } +void Yaz_Proxy::markInvalid() +{ + m_client = 0; + m_invalid_session = 1; +} + void Yaz_ProxyClient::timeoutNotify() { if (m_server) @@ -2191,6 +2199,14 @@ void Yaz_ProxyClient::timeoutNotify() get_hostname()); m_waiting = 1; m_root->pre_init(); + if (m_server && m_init_flag) + { + // target timed out in a session that was properly initialized + // server object stay alive but we mark it as invalid so it + // gets initialized again + m_server->markInvalid(); + m_server = 0; + } shutdown(); }