]> git.ipfire.org Git - thirdparty/squid.git/blame - src/mgr/FunAction.cc
Source Format Enforcement (#763)
[thirdparty/squid.git] / src / mgr / FunAction.cc
CommitLineData
8822ebee 1/*
f70aedc4 2 * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
8822ebee 3 *
bbc27441
AJ
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
8822ebee
AR
7 */
8
bbc27441
AJ
9/* DEBUG: section 16 Cache Manager API */
10
f7f3304a 11#include "squid.h"
8822ebee 12#include "base/TextException.h"
c3e8e4e9 13#include "comm/Connection.h"
582c2af2 14#include "globals.h"
4c218615 15#include "ipc/RequestId.h"
51ea0904 16#include "ipc/UdsOp.h"
8822ebee
AR
17#include "mgr/Command.h"
18#include "mgr/Filler.h"
19#include "mgr/FunAction.h"
20#include "mgr/Request.h"
21#include "Store.h"
5bed43d6 22#include "tools.h"
8822ebee 23
8822ebee
AR
24Mgr::FunAction::Pointer
25Mgr::FunAction::Create(const Command::Pointer &aCmd, OBJH* aHandler)
26{
27 return new FunAction(aCmd, aHandler);
28}
29
30Mgr::FunAction::FunAction(const Command::Pointer &aCmd, OBJH* aHandler):
f53969cc 31 Action(aCmd), handler(aHandler)
8822ebee
AR
32{
33 Must(handler != NULL);
34 debugs(16, 5, HERE);
35}
36
37void
38Mgr::FunAction::respond(const Request& request)
39{
40 debugs(16, 5, HERE);
1b76e6c1
AJ
41 Ipc::ImportFdIntoComm(request.conn, SOCK_STREAM, IPPROTO_TCP, Ipc::fdnHttpSocket);
42 Must(Comm::IsConnOpen(request.conn));
8822ebee 43 Must(request.requestId != 0);
1b76e6c1 44 AsyncJob::Start(new Mgr::Filler(this, request.conn, request.requestId));
8822ebee
AR
45}
46
47void
48Mgr::FunAction::dump(StoreEntry* entry)
49{
50 debugs(16, 5, HERE);
51 Must(entry != NULL);
39c1e1d9 52 if (UsingSmp())
8822ebee
AR
53 storeAppendPrintf(entry, "by kid%d {\n", KidIdentifier);
54 handler(entry);
39c1e1d9 55 if (atomic() && UsingSmp())
8822ebee
AR
56 storeAppendPrintf(entry, "} by kid%d\n\n", KidIdentifier);
57}
f53969cc 58