FunAction.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
3  *
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.
7  */
8 
9 /* DEBUG: section 16 Cache Manager API */
10 
11 #include "squid.h"
12 #include "base/TextException.h"
13 #include "comm/Connection.h"
14 #include "globals.h"
15 #include "ipc/UdsOp.h"
16 #include "mgr/Command.h"
17 #include "mgr/Filler.h"
18 #include "mgr/FunAction.h"
19 #include "mgr/Request.h"
20 #include "Store.h"
21 #include "tools.h"
22 
25 {
26  return new FunAction(aCmd, aHandler);
27 }
28 
30  Action(aCmd), handler(aHandler)
31 {
32  Must(handler != NULL);
33  debugs(16, 5, HERE);
34 }
35 
36 void
38 {
39  debugs(16, 5, HERE);
40  Ipc::ImportFdIntoComm(request.conn, SOCK_STREAM, IPPROTO_TCP, Ipc::fdnHttpSocket);
41  Must(Comm::IsConnOpen(request.conn));
42  Must(request.requestId != 0);
43  AsyncJob::Start(new Mgr::Filler(this, request.conn, request.requestId));
44 }
45 
46 void
48 {
49  debugs(16, 5, HERE);
50  Must(entry != NULL);
51  if (UsingSmp())
52  storeAppendPrintf(entry, "by kid%d {\n", KidIdentifier);
53  handler(entry);
54  if (atomic() && UsingSmp())
55  storeAppendPrintf(entry, "} by kid%d\n\n", KidIdentifier);
56 }
57 
cache manager request
Definition: Request.h:22
struct _request * request(char *urlin)
Definition: tcp-banger2.c:291
RefCount< Action > Pointer
Definition: Action.h:27
FunAction(const CommandPointer &cmd, OBJH *aHandler)
Definition: FunAction.cc:29
void OBJH(StoreEntry *)
Definition: forward.h:44
static Pointer Start(AsyncJob *job)
starts a freshly created job (i.e., makes the job asynchronous)
Definition: AsyncJob.cc:23
bool IsConnOpen(const Comm::ConnectionPointer &conn)
Definition: Connection.cc:24
const Comm::ConnectionPointer & ImportFdIntoComm(const Comm::ConnectionPointer &conn, int socktype, int protocol, FdNoteId noteId)
import socket fd from another strand into our Comm state
Definition: UdsOp.cc:194
OBJH * handler
legacy function that collects and dumps info
Definition: FunAction.h:40
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Debug.h:123
virtual void respond(const Request &request)
respond to Coordinator request; default is to collect and sendResponse
Definition: FunAction.cc:37
unsigned int requestId
unique for sender; matches request w/ response
Definition: Request.h:39
virtual void dump(StoreEntry *entry)
Definition: FunAction.cc:47
static void handler(int signo)
Definition: purge.cc:860
bool UsingSmp()
Whether there should be more than one worker process running.
Definition: tools.cc:658
static Pointer Create(const CommandPointer &cmd, OBJH *aHandler)
Definition: FunAction.cc:24
std::ostream & HERE(std::ostream &s)
Definition: Debug.h:147
#define Must(cond)
Definition: TextException.h:89
Comm::ConnectionPointer conn
HTTP client connection descriptor.
Definition: Request.h:37
provides Coordinator with a local cache manager response
Definition: Filler.h:22
int KidIdentifier
void storeAppendPrintf(StoreEntry *e, const char *fmt,...)
Definition: store.cc:904
#define NULL
Definition: types.h:166

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors