]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/mgr/FunAction.cc
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / mgr / FunAction.cc
index 6fd0f97c1a4140c747f49aff832b08f886de0501..ccba1e6e7266f77fb42fdca604dc828443296419 100644 (file)
@@ -1,19 +1,24 @@
 /*
- * $Id$
- *
- * DEBUG: section 16    Cache Manager API
+ * Copyright (C) 1996-2020 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 16    Cache Manager API */
+
+#include "squid.h"
 #include "base/TextException.h"
+#include "comm/Connection.h"
+#include "globals.h"
 #include "ipc/UdsOp.h"
 #include "mgr/Command.h"
 #include "mgr/Filler.h"
 #include "mgr/FunAction.h"
 #include "mgr/Request.h"
 #include "Store.h"
-
+#include "tools.h"
 
 Mgr::FunAction::Pointer
 Mgr::FunAction::Create(const Command::Pointer &aCmd, OBJH* aHandler)
@@ -22,7 +27,7 @@ Mgr::FunAction::Create(const Command::Pointer &aCmd, OBJH* aHandler)
 }
 
 Mgr::FunAction::FunAction(const Command::Pointer &aCmd, OBJH* aHandler):
-        Action(aCmd), handler(aHandler)
+    Action(aCmd), handler(aHandler)
 {
     Must(handler != NULL);
     debugs(16, 5, HERE);
@@ -32,10 +37,10 @@ void
 Mgr::FunAction::respond(const Request& request)
 {
     debugs(16, 5, HERE);
-    const int fd = Ipc::ImportFdIntoComm(request.fd, SOCK_STREAM, IPPROTO_TCP, Ipc::fdnHttpSocket);
-    Must(fd >= 0);
+    Ipc::ImportFdIntoComm(request.conn, SOCK_STREAM, IPPROTO_TCP, Ipc::fdnHttpSocket);
+    Must(Comm::IsConnOpen(request.conn));
     Must(request.requestId != 0);
-    AsyncJob::Start(new Mgr::Filler(this, fd, request.requestId));
+    AsyncJob::Start(new Mgr::Filler(this, request.conn, request.requestId));
 }
 
 void
@@ -43,9 +48,10 @@ Mgr::FunAction::dump(StoreEntry* entry)
 {
     debugs(16, 5, HERE);
     Must(entry != NULL);
-    if (UsingSmp() && IamWorkerProcess())
+    if (UsingSmp())
         storeAppendPrintf(entry, "by kid%d {\n", KidIdentifier);
     handler(entry);
-    if (atomic() && UsingSmp() && IamWorkerProcess())
+    if (atomic() && UsingSmp())
         storeAppendPrintf(entry, "} by kid%d\n\n", KidIdentifier);
 }
+