/*
- * $Id$
- *
- * DEBUG: section 54 Interprocess Communication
+ * 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.
+ * Please see the COPYING and CONTRIBUTORS files for details.
*/
+/* DEBUG: section 54 Interprocess Communication */
+
#ifndef SQUID_IPC_INQUIRER_H
#define SQUID_IPC_INQUIRER_H
-#include "base/AsyncJobCalls.h"
#include "base/AsyncJob.h"
+#include "base/AsyncJobCalls.h"
+#include "base/forward.h"
#include "ipc/forward.h"
#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_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(unsigned int requestId);
-
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<unsigned int, AsyncCall::Pointer> RequestsMap;
- static RequestsMap TheRequestsMap; ///< pending strand requests
-
- static unsigned int LastRequestId; ///< last requestId used
-
- CBDATA_CLASS2(Inquirer);
+ static RequestId::Index LastRequestId; ///< last requestId used
};
} // namespace Ipc
#endif /* SQUID_IPC_INQUIRER_H */
+