Router: use shared_ptr rather than naked one
[metaproxy-moved-to-github.git] / src / router_flexml.cpp
index 987a9d9..6e246d9 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of Metaproxy.
-   Copyright (C) 2005-2012 Index Data
+   Copyright (C) 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
@@ -130,15 +130,14 @@ void mp::RouterFleXML::Rep::parse_xml_filters(xmlDocPtr doc,
                     type_value.c_str(), m_dl_path.c_str());
             m_factory->add_creator_dl(type_value, m_dl_path);
         }
-        mp::filter::Base* filter_base = m_factory->create(type_value);
+        boost::shared_ptr<mp::filter::Base> fb(m_factory->create(type_value));
 
-        filter_base->configure(node, test_only, file_include_path);
+        fb->configure(node, test_only, file_include_path);
 
         if (m_id_filter_map.find(id_value) != m_id_filter_map.end())
             throw mp::XMLError("Filter " + id_value + " already defined");
 
-        m_id_filter_map[id_value] =
-            boost::shared_ptr<mp::filter::Base>(filter_base);
+        m_id_filter_map[id_value] = fb;
 
         node = mp::xml::jump_to_next(node, XML_ELEMENT_NODE);
     }
@@ -315,7 +314,8 @@ void mp::RouterFleXML::Rep::parse_xml_config_dom(xmlDocPtr doc,
 
     if (file_include_path)
     {
-        int r = yaz_xml_include_simple((xmlNode *) root, file_include_path);
+        int r = yaz_xml_include_glob((xmlNode *) root, file_include_path,
+            YAZ_FILE_GLOB_FAIL_NOTEXIST);
         if (r)
             throw mp::XMLError("YAZ XML Include failed");
     }
@@ -503,7 +503,7 @@ void mp::RouterFleXML::start()
     }
 }
 
-void mp::RouterFleXML::stop()
+void mp::RouterFleXML::stop(int signo)
 {
     std::map<std::string,RouterFleXML::Route>::iterator route_it;
 
@@ -515,7 +515,7 @@ void mp::RouterFleXML::stop()
         std::list<boost::shared_ptr<const mp::filter::Base> >::iterator it;
 
         for (it = route.m_list.begin(); it != route.m_list.end(); it++)
-            (*it)->stop();
+            (*it)->stop(signo);
         route_it++;
     }
 }