]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/ipc/Coordinator.cc
Renamed squid.h to squid-old.h and config.h to squid.h
[thirdparty/squid.git] / src / ipc / Coordinator.cc
index 91b8d9ee4406b9ae120fb0495122cc89982a04b4..6f1a10a31ff374071b4ce08cc7aad9cdd5bd81ed 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 
-#include "config.h"
+#include "squid.h"
 #include "base/Subscription.h"
 #include "base/TextException.h"
 #include "CacheManager.h"
@@ -66,9 +66,9 @@ void Ipc::Coordinator::registerStrand(const StrandCoord& strand)
         if (i->tag == strand.tag) {
             notifySearcher(*i, strand);
             i = searchers.erase(i);
-               } else {
+        } else {
             ++i;
-               }
+        }
     }
 }
 
@@ -164,15 +164,25 @@ Ipc::Coordinator::handleCacheMgrRequest(const Mgr::Request& request)
 {
     debugs(54, 4, HERE);
 
+    try {
+        Mgr::Action::Pointer action =
+            CacheManager::GetInstance()->createRequestedAction(request.params);
+        AsyncJob::Start(new Mgr::Inquirer(action, request, strands_));
+    } catch (const std::exception &ex) {
+        debugs(54, DBG_IMPORTANT, "BUG: cannot aggregate mgr:" <<
+               request.params.actionName << ": " << ex.what());
+        // TODO: Avoid half-baked Connections or teach them how to close.
+        ::close(request.conn->fd);
+        request.conn->fd = -1;
+        return; // the worker will timeout and close
+    }
+
     // Let the strand know that we are now responsible for handling the request
     Mgr::Response response(request.requestId);
     TypedMsgHdr message;
     response.pack(message);
     SendMessage(MakeAddr(strandAddrPfx, request.requestorId), message);
 
-    Mgr::Action::Pointer action =
-        CacheManager::GetInstance()->createRequestedAction(request.params);
-    AsyncJob::Start(new Mgr::Inquirer(action, request, strands_));
 }
 
 void
@@ -195,11 +205,11 @@ Ipc::Coordinator::handleSearchRequest(const Ipc::StrandSearchRequest &request)
     if (strand) {
         notifySearcher(request, *strand);
         return;
-       }
+    }
 
     searchers.push_back(request);
     debugs(54, 3, HERE << "cannot yet tell kid" << request.requestorId <<
-        " who " << request.tag << " is");
+           " who " << request.tag << " is");
 }
 
 void
@@ -207,7 +217,7 @@ Ipc::Coordinator::notifySearcher(const Ipc::StrandSearchRequest &request,
                                  const StrandCoord& strand)
 {
     debugs(54, 3, HERE << "tell kid" << request.requestorId << " that " <<
-        request.tag << " is kid" << strand.kidId);
+           request.tag << " is kid" << strand.kidId);
     const StrandSearchResponse response(strand);
     TypedMsgHdr message;
     response.pack(message);