Browse Source

[trac534] Create the origin at zone creation

No need to check every time this added domain isn't origin, we create
one at creation of zone and keep it.
Michal 'vorner' Vaner 14 years ago
parent
commit
3372c33145
1 changed files with 6 additions and 4 deletions
  1. 6 4
      src/lib/datasrc/memory_datasrc.cc

+ 6 - 4
src/lib/datasrc/memory_datasrc.cc

@@ -36,7 +36,12 @@ struct MemoryZone::MemoryZoneImpl {
     // Constructor
     MemoryZoneImpl(const RRClass& zone_class, const Name& origin) :
         zone_class_(zone_class), origin_(origin), origin_data_(NULL)
-    {}
+    {
+        // We create the node for origin (it needs to exist anyway in future)
+        domains_.insert(origin, &origin_data_);
+        DomainPtr origin_domain(new Domain);
+        origin_data_->setData(origin_domain);
+    }
 
     // Some type aliases
     /*
@@ -158,9 +163,6 @@ struct MemoryZone::MemoryZoneImpl {
         if (node->isEmpty()) {
             domain.reset(new Domain);
             node->setData(domain);
-            if (origin_data_ == NULL && name == origin_) {
-                origin_data_ = node;
-            }
         } else { // Get existing one
             domain = node->getData();
         }