FunAction.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2022 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/RequestId.h"
16 #include "ipc/UdsOp.h"
17 #include "mgr/Command.h"
18 #include "mgr/Filler.h"
19 #include "mgr/FunAction.h"
20 #include "mgr/Request.h"
21 #include "Store.h"
22 #include "tools.h"
23 
26 {
27  return new FunAction(aCmd, aHandler);
28 }
29 
31  Action(aCmd), handler(aHandler)
32 {
33  Must(handler != NULL);
34  debugs(16, 5, MYNAME);
35 }
36 
37 void
39 {
40  debugs(16, 5, MYNAME);
41  Ipc::ImportFdIntoComm(request.conn, SOCK_STREAM, IPPROTO_TCP, Ipc::fdnHttpSocket);
43  Must(request.requestId != 0);
44  AsyncJob::Start(new Mgr::Filler(this, request.conn, request.requestId));
45 }
46 
47 void
49 {
50  debugs(16, 5, MYNAME);
51  Must(entry != NULL);
52  if (UsingSmp())
53  storeAppendPrintf(entry, "by kid%d {\n", KidIdentifier);
54  handler(entry);
55  if (atomic() && UsingSmp())
56  storeAppendPrintf(entry, "} by kid%d\n\n", KidIdentifier);
57 }
58 
virtual void respond(const Request &request)
respond to Coordinator request; default is to collect and sendResponse
Definition: FunAction.cc:38
static void handler(int signo)
Definition: purge.cc:854
int KidIdentifier
void storeAppendPrintf(StoreEntry *e, const char *fmt,...)
Definition: store.cc:830
FunAction(const CommandPointer &cmd, OBJH *aHandler)
Definition: FunAction.cc:30
bool IsConnOpen(const Comm::ConnectionPointer &conn)
Definition: Connection.cc:27
OBJH * handler
legacy function that collects and dumps info
Definition: FunAction.h:40
virtual void dump(StoreEntry *entry)
Definition: FunAction.cc:48
void OBJH(StoreEntry *)
Definition: forward.h:44
#define NULL
Definition: types.h:166
cache manager request
Definition: Request.h:23
@ fdnHttpSocket
Definition: FdNotes.h:20
static Pointer Create(const CommandPointer &cmd, OBJH *aHandler)
Definition: FunAction.cc:25
#define Must(condition)
Definition: TextException.h:71
#define MYNAME
Definition: Stream.h:238
provides Coordinator with a local cache manager response
Definition: Filler.h: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
RefCount< Action > Pointer
Definition: Action.h:27
bool UsingSmp()
Whether there should be more than one worker process running.
Definition: tools.cc:693
struct _request * request(char *urlin)
Definition: tcp-banger2.c:291
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Stream.h:196
static void Start(const Pointer &job)
Definition: AsyncJob.cc:24

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors