]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/CollapsedForwarding.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / CollapsedForwarding.cc
index fc48fa94fa047c62cb0f43eada5ecbe9af4abbe3..c86e0306f43445074c8765e1a2dcfcaa3a5cf9f4 100644 (file)
@@ -1,16 +1,21 @@
 /*
- * DEBUG: section 17    Request Forwarding
+ * Copyright (C) 1996-2015 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.
  */
 
+/* DEBUG: section 17    Request Forwarding */
+
 #include "squid.h"
+#include "CollapsedForwarding.h"
+#include "globals.h"
 #include "ipc/mem/Segment.h"
 #include "ipc/Messages.h"
 #include "ipc/Port.h"
 #include "ipc/TypedMsgHdr.h"
 #include "MemObject.h"
-#include "CollapsedForwarding.h"
-#include "globals.h"
 #include "SquidConfig.h"
 #include "Store.h"
 #include "store_key_md5.h"
@@ -34,7 +39,7 @@ public:
     int sender; ///< kid ID of sending process
 
     /// transients index, so that workers can find [private] entries to sync
-    sfileno xitIndex; 
+    sfileno xitIndex;
 };
 
 // CollapsedForwarding
@@ -54,7 +59,7 @@ CollapsedForwarding::Broadcast(const StoreEntry &e)
         return;
 
     if (!e.mem_obj || e.mem_obj->xitTable.index < 0 ||
-        !Store::Root().transientReaders(e)) {
+            !Store::Root().transientReaders(e)) {
         debugs(17, 7, "nobody reads " << e);
         return;
     }
@@ -85,10 +90,9 @@ CollapsedForwarding::Notify(const int workerId)
     // TODO: Count and report the total number of notifications, pops, pushes.
     debugs(17, 7, "to kid" << workerId);
     Ipc::TypedMsgHdr msg;
-    // TODO: add proper message type?
     msg.setType(Ipc::mtCollapsedForwardingNotification);
     msg.putInt(KidIdentifier);
-    const String addr = Ipc::Port::MakeAddr(Ipc::strandAddrPfx, workerId);
+    const String addr = Ipc::Port::MakeAddr(Ipc::strandAddrLabel, workerId);
     Ipc::SendMessage(addr, msg);
 }
 
@@ -111,7 +115,8 @@ CollapsedForwarding::HandleNewData(const char *const when)
         debugs(17, 7, "handled entry " << msg.xitIndex << " in transients_map");
 
         // XXX: stop and schedule an async call to continue
-        assert(++poppedCount < SQUID_MAXFD);
+        ++poppedCount;
+        assert(poppedCount < SQUID_MAXFD);
     }
 }
 
@@ -134,16 +139,16 @@ public:
     virtual ~CollapsedForwardingRr();
 
 protected:
-    virtual void create(const RunnerRegistry &);
-    virtual void open(const RunnerRegistry &);
+    virtual void create();
+    virtual void open();
 
 private:
     Ipc::MultiQueue::Owner *owner;
 };
 
-RunnerRegistrationEntry(rrAfterConfig, CollapsedForwardingRr);
+RunnerRegistrationEntry(CollapsedForwardingRr);
 
-void CollapsedForwardingRr::create(const RunnerRegistry &)
+void CollapsedForwardingRr::create()
 {
     Must(!owner);
     owner = Ipc::MultiQueue::Init(ShmLabel, Config.workers, 1,
@@ -151,7 +156,7 @@ void CollapsedForwardingRr::create(const RunnerRegistry &)
                                   QueueCapacity);
 }
 
-void CollapsedForwardingRr::open(const RunnerRegistry &)
+void CollapsedForwardingRr::open()
 {
     CollapsedForwarding::Init();
 }
@@ -160,3 +165,4 @@ CollapsedForwardingRr::~CollapsedForwardingRr()
 {
     delete owner;
 }
+