You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by br...@apache.org on 2014/09/05 23:26:17 UTC
[3/4] git commit: Cppapi: Fix for crashes in intercept
Cppapi: Fix for crashes in intercept
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/59edc697
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/59edc697
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/59edc697
Branch: refs/heads/master
Commit: 59edc697c28f123bb3578ee17e2d87f1e8d8568e
Parents: 4805426
Author: Brian Geffon <br...@apache.org>
Authored: Fri Sep 5 14:25:46 2014 -0700
Committer: Brian Geffon <br...@apache.org>
Committed: Fri Sep 5 14:25:46 2014 -0700
----------------------------------------------------------------------
lib/atscppapi/src/InterceptPlugin.cc | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/59edc697/lib/atscppapi/src/InterceptPlugin.cc
----------------------------------------------------------------------
diff --git a/lib/atscppapi/src/InterceptPlugin.cc b/lib/atscppapi/src/InterceptPlugin.cc
index c7e3f8c..9384fea 100644
--- a/lib/atscppapi/src/InterceptPlugin.cc
+++ b/lib/atscppapi/src/InterceptPlugin.cc
@@ -319,13 +319,16 @@ int handleEvents(TSCont cont, TSEvent event, void *edata) {
state->timeout_action_ = TSContSchedule(cont, 1, TS_THREAD_POOL_DEFAULT);
return 0;
}
+ if (event == TS_EVENT_TIMEOUT) {
+ state->timeout_action_ = NULL;
+ event = state->saved_event_; // restore saved event
+ edata = state->saved_edata_;
+ }
if (state->plugin_) {
- if (event == TS_EVENT_TIMEOUT) { // restore original event
- event = state->saved_event_;
- edata = state->saved_edata_;
- }
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
LOG_DEBUG("Cleaning up as intercept plugin is already destroyed");
destroyCont(state);
@@ -340,10 +343,6 @@ void destroyCont(InterceptPlugin::State *state) {
TSVConnClose(state->net_vc_);
state->net_vc_ = NULL;
}
- if (state->timeout_action_) {
- TSActionCancel(state->timeout_action_);
- state->timeout_action_ = NULL;
- }
TSContDestroy(state->cont_);
}