libi2ncommon: (reinhard) fixed the "var list does not vanish" problem.
authorReinhard Pfau <reinhard.pfau@intra2net.com>
Thu, 4 Sep 2008 14:19:43 +0000 (14:19 +0000)
committerReinhard Pfau <reinhard.pfau@intra2net.com>
Thu, 4 Sep 2008 14:19:43 +0000 (14:19 +0000)
configlib/i2n_global_config.cpp

index 5c4c1e8..332ecfb 100644 (file)
@@ -251,8 +251,43 @@ bool feedEm( ConfigData& old_config_data )
                 continue;
             }
             // at this point we don't have (new) data, but we had old data...
-            //TODO how to handle this case? (reset to initial value??)
-            // for now, we ignore it.
+            {
+                DOUT("had old data");
+                StringList values;
+
+                // at this point we need to publish (vanished) value:
+                HideOutMap::GroupDataType::ValueListType func_list;
+                hideout_map()[section].getValues(key, func_list);
+                for(HideOutMap::GroupDataType::ValueListType::iterator func_it= func_list.begin();
+                    func_it != func_list.end();
+                    ++func_it)
+                {
+                    DOUT("  feed iteration");
+                    if (not (*func_it)) //paranoia
+                    {
+                        continue;
+                    }
+                    if ( (*func_it)->m_feed)
+                    {
+                        //TODO reset the data (to initial value) somehow?
+                        // for now; we just keep the last value...
+                        continue;
+                    }
+                    if ( (*func_it)->m_feed2)
+                    {
+                        if ( not (*func_it)->m_feed2( values ) )
+                        {
+                            module_logger().error() << "unable to publish [" <<section << "]"
+                                << " \"" << key << "\"  : <empty> "
+                            ;
+                            result= false;
+                        }
+                        continue;
+                    }
+                    module_logger().error() << "no feeder";
+                }
+                continue;
+            }
         }
     }
     return result;