You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2018/07/05 17:06:04 UTC

[trafficserver] 05/06: Changed destroy logic

This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch 8.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit b83801465511706648d088a645ead1ea888819bb
Author: dyrock <ze...@gmail.com>
AuthorDate: Tue Jul 3 21:10:57 2018 +0000

    Changed destroy logic
    
    (cherry picked from commit 587ca645791586e1af2a4f88a3bbd73a1bd2751e)
---
 lib/cppapi/InterceptPlugin.cc | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/cppapi/InterceptPlugin.cc b/lib/cppapi/InterceptPlugin.cc
index 008e6cb..d47e52a 100644
--- a/lib/cppapi/InterceptPlugin.cc
+++ b/lib/cppapi/InterceptPlugin.cc
@@ -374,8 +374,7 @@ handleEvents(TSCont cont, TSEvent pristine_event, void *pristine_edata)
   }
   if (state->plugin_) {
     utils::internal::dispatchInterceptEvent(state->plugin_, event, edata);
-  } else if (state->timeout_action_) { // we had scheduled a timeout on ourselves; let's wait for it
-  } else {                             // plugin was destroyed before intercept was completed; cleaning up here
+  } else { // plugin was destroyed before intercept was completed; cleaning up here
     LOG_DEBUG("Cleaning up as intercept plugin is already destroyed");
     destroyCont(state);
     TSContDataSet(cont, nullptr);
@@ -392,7 +391,12 @@ destroyCont(InterceptPlugin::State *state)
     TSVConnClose(state->net_vc_);
     state->net_vc_ = nullptr;
   }
-  if (!state->timeout_action_) {
+
+  if (state->cont_) {
+    if (state->timeout_action_) {
+      TSActionCancel(state->timeout_action_);
+      state->timeout_action_ = nullptr;
+    }
     TSContDestroy(state->cont_);
     state->cont_ = nullptr;
   }