]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/ipc/Inquirer.h
Source Format Enforcement (#1234)
[thirdparty/squid.git] / src / ipc / Inquirer.h
index f1e3fad49619b8ed6aaf8571eb7fb3c35c2ab341..56ef3c8c5c1762c49354116e4c7d13dbf3808c02 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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 "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
 {
@@ -26,24 +26,26 @@ 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();
@@ -57,12 +59,8 @@ protected:
     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();
@@ -75,11 +73,7 @@ protected:
 
     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
+    static RequestId::Index LastRequestId; ///< last requestId used
 };
 
 } // namespace Ipc