]> git.ipfire.org Git - thirdparty/squid.git/blob - src/mgr/FunAction.cc
Merged from parent (trunk r11623, v3.2.0.10+).
[thirdparty/squid.git] / src / mgr / FunAction.cc
1 /*
2 * $Id$
3 *
4 * DEBUG: section 16 Cache Manager API
5 *
6 */
7
8 #include "config.h"
9 #include "base/TextException.h"
10 #include "comm/Connection.h"
11 #include "ipc/UdsOp.h"
12 #include "mgr/Command.h"
13 #include "mgr/Filler.h"
14 #include "mgr/FunAction.h"
15 #include "mgr/Request.h"
16 #include "Store.h"
17
18
19 Mgr::FunAction::Pointer
20 Mgr::FunAction::Create(const Command::Pointer &aCmd, OBJH* aHandler)
21 {
22 return new FunAction(aCmd, aHandler);
23 }
24
25 Mgr::FunAction::FunAction(const Command::Pointer &aCmd, OBJH* aHandler):
26 Action(aCmd), handler(aHandler)
27 {
28 Must(handler != NULL);
29 debugs(16, 5, HERE);
30 }
31
32 void
33 Mgr::FunAction::respond(const Request& request)
34 {
35 debugs(16, 5, HERE);
36 Ipc::ImportFdIntoComm(request.conn, SOCK_STREAM, IPPROTO_TCP, Ipc::fdnHttpSocket);
37 Must(Comm::IsConnOpen(request.conn));
38 Must(request.requestId != 0);
39 AsyncJob::Start(new Mgr::Filler(this, request.conn, request.requestId));
40 }
41
42 void
43 Mgr::FunAction::dump(StoreEntry* entry)
44 {
45 debugs(16, 5, HERE);
46 Must(entry != NULL);
47 if (UsingSmp())
48 storeAppendPrintf(entry, "by kid%d {\n", KidIdentifier);
49 handler(entry);
50 if (atomic() && UsingSmp())
51 storeAppendPrintf(entry, "} by kid%d\n\n", KidIdentifier);
52 }