]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2853] Use info.ztable_segment_ as indicator of unused segment
authorMukund Sivaraman <muks@isc.org>
Wed, 12 Jun 2013 15:13:12 +0000 (20:43 +0530)
committerMukund Sivaraman <muks@isc.org>
Wed, 12 Jun 2013 15:13:12 +0000 (20:43 +0530)
src/lib/datasrc/client_list.cc
src/lib/datasrc/client_list.h

index d1bef5a6297a315395b19c110f40f21f9d086e96..58444b7caf8bb0cc7b790e13be795e0316b54169 100644 (file)
@@ -410,22 +410,15 @@ vector<DataSourceStatus>
 ConfigurableClientList::getStatus() const {
     vector<DataSourceStatus> result;
     BOOST_FOREACH(const DataSourceInfo& info, data_sources_) {
-        MemorySegmentState segment_state = SEGMENT_UNUSED;
-        if (info.cache_) {
-            if (info.ztable_segment_ && info.ztable_segment_->isUsable()) {
-                segment_state = SEGMENT_INUSE;
-            } else {
-                segment_state = SEGMENT_WAITING;
-            }
-        }
-
-        std::string segment_type;
         if (info.ztable_segment_) {
-            segment_type = info.ztable_segment_->getImplType();
+            result.push_back(DataSourceStatus(
+                info.name_,
+                (info.ztable_segment_->isUsable() ?
+                 SEGMENT_INUSE : SEGMENT_WAITING),
+                info.ztable_segment_->getImplType()));
+        } else {
+            result.push_back(DataSourceStatus(info.name_, SEGMENT_UNUSED));
         }
-
-        result.push_back(DataSourceStatus(info.name_, segment_state,
-                                          segment_type));
     }
     return (result);
 }
index b3ac9b3dd8cd3560d04fe7e4a108ed52b91ca345..880679a335523fd33cc6abbf545cfa44d4eae34c 100644 (file)
@@ -84,7 +84,7 @@ public:
     /// Sets initial values. It doesn't matter what is provided for the type
     /// if state is SEGMENT_UNUSED, the value is effectively ignored.
     DataSourceStatus(const std::string& name, MemorySegmentState state,
-                     const std::string& type) :
+                     const std::string& type = std::string()) :
         name_(name),
         type_(type),
         state_(state)