]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/ipc/Inquirer.h
Source Format Enforcement (#1234)
[thirdparty/squid.git] / src / ipc / Inquirer.h
index 374334779332c614511f2ce5e8bf41e030e1fdc5..56ef3c8c5c1762c49354116e4c7d13dbf3808c02 100644 (file)
@@ -1,18 +1,23 @@
 /*
- * 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/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
 {
@@ -21,22 +26,26 @@ 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();
@@ -50,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();
@@ -68,15 +73,10 @@ 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
-
-    CBDATA_CLASS2(Inquirer);
+    static RequestId::Index LastRequestId; ///< last requestId used
 };
 
 } // namespace Ipc
 
 #endif /* SQUID_IPC_INQUIRER_H */
+