maskit commented on a change in pull request #7667:
URL: https://github.com/apache/trafficserver/pull/7667#discussion_r606040031



##########
File path: proxy/http/HttpSM.h
##########
@@ -166,6 +166,52 @@ enum HttpPluginTunnel_t {
 
 class PluginVCCore;
 
+class PendingAction
+{
+public:
+  bool
+  operator==(Action *b)
+  {
+    return b == pending_action;
+  }
+  bool
+  operator!=(Action *b)
+  {
+    return b != pending_action;
+  }
+  PendingAction &
+  operator=(Action *b)
+  {
+    // Don't do anything if the new action is _DONE
+    if (b != ACTION_RESULT_DONE) {
+      if (b != pending_action && pending_action != nullptr) {
+        pending_action->cancel();
+      }
+      pending_action = b;
+    }
+    return *this;
+  }
+  Action *
+  operator->()
+  {
+    return pending_action;
+  }
+  Action *
+  get()
+  {
+    return pending_action;
+  }
+  ~PendingAction()

Review comment:
       I'm not saying we don't need the destructor. My understanding is that 
this change is to ensure pending_action won't be triggered after HttpSM got 
unavailable. Manually canceling the action by assigning nullptr is fine. I just 
thought the current code doesn't fully take the benefit of PendingAction class.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to