/*
- * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
*
* Squid software is distributed under GPLv2+ license and includes
* contributions from numerous individuals and organizations.
#include "ipc/Request.h"
#include "ipc/Response.h"
#include "ipc/StrandCoords.h"
-#include <map>
namespace Ipc
{
/// aggregating individual strand responses and dumping the result if needed
class Inquirer: public AsyncJob
{
- CBDATA_CLASS(Inquirer);
+ CBDATA_INTERMEDIATE();
public:
Inquirer(Request::Pointer aRequest, const Ipc::StrandCoords& coords, double aTimeout);
- virtual ~Inquirer();
+ ~Inquirer() override;
/// finds and calls the right Inquirer upon strand's response
static void HandleRemoteAck(const Response& response);
/* has-to-be-public AsyncJob API */
- virtual void callException(const std::exception& e);
+ void callException(const std::exception& e) override;
CodeContextPointer codeContext;
protected:
/* AsyncJob API */
- virtual void start();
- virtual void swanSong();
- virtual bool doneAll() const;
- virtual const char *status() const;
+ void start() override;
+ void swanSong() override;
+ bool doneAll() const override;
+ const char *status() const override;
/// inquire the next strand
virtual void inquire();
virtual bool aggregate(Response::Pointer aResponse) = 0;
private:
- typedef UnaryMemFunT<Inquirer, Response::Pointer, Response::Pointer> HandleAckDialer;
-
void handleRemoteAck(Response::Pointer response);
- static AsyncCall::Pointer DequeueRequest(RequestId::Index);
-
static void RequestTimedOut(void* param);
void requestTimedOut();
void removeTimeoutEvent();
const double timeout; ///< number of seconds to wait for strand response
- /// maps request->id to Inquirer::handleRemoteAck callback
- typedef std::map<RequestId::Index, AsyncCall::Pointer> RequestsMap;
- static RequestsMap TheRequestsMap; ///< pending strand requests
-
static RequestId::Index LastRequestId; ///< last requestId used
};