]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/ipc/Kids.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / ipc / Kids.cc
index 55f877f890493e8ad235a02a377cc14112664027..7cb5704ea5511ad132572d822bb221d5224c5330 100644 (file)
@@ -1,13 +1,19 @@
 /*
- * $Id$
- *
- * DEBUG: section 54    Interprocess Communication
+ * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
  *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
  */
 
-#include "config.h"
+/* DEBUG: section 54    Interprocess Communication */
+
+#include "squid.h"
+#include "base/TextException.h"
+#include "globals.h"
 #include "ipc/Kids.h"
-#include "protos.h"
+#include "SquidConfig.h"
+#include "tools.h"
 
 Kids TheKids;
 KidName TheKidName;
@@ -19,8 +25,7 @@ Kids::Kids()
 /// maintain n kids
 void Kids::init()
 {
-    if (storage.size() > 0)
-        storage.clean();
+    storage.clear();
 
     storage.reserve(NumberOfKids());
 
@@ -33,8 +38,7 @@ void Kids::init()
     }
 
     // add Kid records for all disk processes
-    // (XXX: some cache_dirs do not need this)
-    for (int i = 0; i < Config.cacheSwap.n_configured; ++i) {
+    for (int i = 0; i < Config.cacheSwap.n_strands; ++i) {
         snprintf(kid_name, sizeof(kid_name), "(squid-disk-%d)", (int)(storage.size()+1));
         storage.push_back(Kid(kid_name));
     }
@@ -44,6 +48,8 @@ void Kids::init()
         snprintf(kid_name, sizeof(kid_name), "(squid-coord-%d)", (int)(storage.size()+1));
         storage.push_back(Kid(kid_name));
     }
+
+    Must(storage.size() == static_cast<size_t>(NumberOfKids()));
 }
 
 /// returns kid by pid
@@ -121,3 +127,4 @@ size_t Kids::count() const
 {
     return storage.size();
 }
+