]> git.ipfire.org Git - thirdparty/squid.git/blob - src/mgr/FunAction.cc
Merge from trunk
[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 "mgr/Command.h"
12 #include "mgr/Filler.h"
13 #include "mgr/FunAction.h"
14 #include "mgr/Request.h"
15 #include "Store.h"
16
17
18 Mgr::FunAction::Pointer
19 Mgr::FunAction::Create(const Command::Pointer &aCmd, OBJH* aHandler)
20 {
21 return new FunAction(aCmd, aHandler);
22 }
23
24 Mgr::FunAction::FunAction(const Command::Pointer &aCmd, OBJH* aHandler):
25 Action(aCmd), handler(aHandler)
26 {
27 Must(handler != NULL);
28 debugs(16, 5, HERE);
29 }
30
31 void
32 Mgr::FunAction::respond(const Request& request)
33 {
34 debugs(16, 5, HERE);
35 const Comm::ConnectionPointer client = ImportHttpFdIntoComm(request.fd);
36 Must(Comm::IsConnOpen(client));
37 Must(request.requestId != 0);
38 AsyncJob::Start(new Mgr::Filler(this, client, request.requestId));
39 }
40
41 void
42 Mgr::FunAction::dump(StoreEntry* entry)
43 {
44 debugs(16, 5, HERE);
45 Must(entry != NULL);
46 if (UsingSmp() && IamWorkerProcess())
47 storeAppendPrintf(entry, "by kid%d {\n", KidIdentifier);
48 handler(entry);
49 if (atomic() && UsingSmp() && IamWorkerProcess())
50 storeAppendPrintf(entry, "} by kid%d\n\n", KidIdentifier);
51 }