Version 1.3.8
[yazproxy-moved-to-github.git] / src / yaz-proxy.cpp
index 7233565..6cb13ea 100644 (file)
@@ -340,6 +340,8 @@ Yaz_Proxy::~Yaz_Proxy()
         odr_destroy(m_s2z_odr_init);
     if (m_s2z_odr_search)
         odr_destroy(m_s2z_odr_search);
+    if (m_s2z_odr_scan)
+        odr_destroy(m_s2z_odr_scan);
     if (!m_parent)
         low_socket_close();
     if (!m_parent)
@@ -531,10 +533,8 @@ const char *Yaz_Proxy::load_balance(const char **url)
             }
     }
     int min_use = 100000;
-    int spare_for_min = 0;
     int max_spare = 0;
     const char *ret_min = 0;
-    const char *ret_spare = 0;
     for (i = 0; url[i]; i++)
     {
         yaz_log(YLOG_DEBUG, "%szurl=%s use=%d spare=%d",
@@ -543,11 +543,9 @@ const char *Yaz_Proxy::load_balance(const char **url)
         {
             ret_min = url[i];
             min_use = zurl_in_use[i];
-            spare_for_min = zurl_in_spare[i];
         }
         if (max_spare < zurl_in_spare[i])
         {
-            ret_spare = url[i];
             max_spare = zurl_in_spare[i];
         }
     }
@@ -2591,13 +2589,13 @@ Z_APDU *Yaz_Proxy::handle_query_validation(Z_APDU *apdu)
         int err = 0;
         char *addinfo = 0;
 
+#if 0
         Yaz_ProxyConfig *cfg = check_reconfigure();
 // Something like this needs to be implemented later:
-/*
         if (cfg)
             err = cfg->check_type_1_attributes(odr_encode(), m_default_target,
                                    sr->termListAndStartPoint->attributes, &addinfo);
-*/
+#endif
         if (err)
         {
             Z_APDU *new_apdu = create_Z_PDU(Z_APDU_scanResponse);
@@ -2774,8 +2772,10 @@ Z_APDU *Yaz_Proxy::handle_syntax_validation(Z_APDU *apdu)
         }
         if (m_backend_elementset)
         {
-            Z_ElementSetNames *esn = mk_esn_from_schema(odr_encode(),
-                                                        m_backend_elementset);
+            Z_ElementSetNames *esn =
+                mk_esn_from_schema(
+                    odr_encode(),
+                    *m_backend_elementset ? m_backend_elementset : 0);
             sr->smallSetElementSetNames = esn;
             sr->mediumSetElementSetNames = esn;
         }
@@ -2851,8 +2851,10 @@ Z_APDU *Yaz_Proxy::handle_syntax_validation(Z_APDU *apdu)
         }
         if (m_backend_elementset)
         {
-            Z_ElementSetNames *esn = mk_esn_from_schema(odr_encode(),
-                                                        m_backend_elementset);
+            Z_ElementSetNames *esn =
+                mk_esn_from_schema(
+                    odr_encode(),
+                    *m_backend_elementset ? m_backend_elementset : 0);
             Z_RecordComposition *comp = (Z_RecordComposition *)
                 odr_malloc(odr_encode(), sizeof(Z_RecordComposition));
             comp->which = Z_RecordComp_simple;