Utils/Console: Fix rename Target::clear() to Target::flush() to fix name clash (Targe...
[senf.git] / Utils / Logger / Target.cc
index 2cc923d..068631c 100644 (file)
@@ -85,6 +85,8 @@ prefix_ void senf::log::Target::unroute(std::string const & stream, std::string
 
 prefix_ void senf::log::Target::unroute(int index)
 {
+    if (rib_.empty())
+        return;
     RIB::iterator i;
     if (index < 0) {
         if (RIB::size_type(-index) >= rib_.size())
@@ -110,6 +112,17 @@ prefix_ void senf::log::Target::unroute(int index)
         updateRoutingCache(entry.stream_, entry.area_);
 }
 
+prefix_ void senf::log::Target::flush()
+{
+    RIB old;
+    rib_.swap(old);
+    RIB::const_iterator i (old.begin());
+    RIB::const_iterator const i_end (old.end());
+    for (; i != i_end; ++i)
+        if (i->action_ == ACCEPT)
+            updateRoutingCache(i->stream_, i->area_);
+}
+
 ////////////////////////////////////////
 // private members