trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sor...@apache.org
Subject [1/2] trafficserver git commit: TS-3491: background_fetch: Only release URL if we were scheduled
Date Fri, 03 Apr 2015 17:42:15 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master f4bbdd921 -> 6fbe03ad1


TS-3491: background_fetch: Only release URL if we were scheduled


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/9f33e9ef
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/9f33e9ef
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/9f33e9ef

Branch: refs/heads/master
Commit: 9f33e9ef88bcab99ebc4d1d5d6d45c2c8cd986da
Parents: f4bbdd9
Author: John Rushford <John_Rushford@cable.comcast.com>
Authored: Fri Apr 3 11:35:58 2015 -0600
Committer: Phil Sorber <sorber@apache.org>
Committed: Fri Apr 3 11:36:37 2015 -0600

----------------------------------------------------------------------
 CHANGES                                                   |  2 ++
 plugins/experimental/background_fetch/background_fetch.cc | 10 ++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9f33e9ef/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index d79a2b5..154a657 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 6.0.0
 
+  *) [TS-3491] background_fetch: Only release URL if we were scheduled.
+
   *) [TS-3448] Add a new Mod operator to ControlMatcher, named "internal".
 
   *) [TS-3483] Fix regex remap to work with CONNECT.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/9f33e9ef/plugins/experimental/background_fetch/background_fetch.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/background_fetch/background_fetch.cc b/plugins/experimental/background_fetch/background_fetch.cc
index 22b23dc..06bd076 100644
--- a/plugins/experimental/background_fetch/background_fetch.cc
+++ b/plugins/experimental/background_fetch/background_fetch.cc
@@ -294,6 +294,8 @@ public:
     }
     TSMutexUnlock(_lock);
 
+    TSDebug (PLUGIN_NAME, "BGFetchConfig.acquire(): ret = %d, url = %s\n", ret, url.c_str());
+
     return ret;
   }
 
@@ -332,14 +334,16 @@ static int cont_bg_fetch(TSCont contp, TSEvent event, void *edata);
 
 struct BGFetchData {
   BGFetchData(BGFetchConfig *cfg = gConfig)
-    : hdr_loc(TS_NULL_MLOC), url_loc(TS_NULL_MLOC), vc(NULL), _bytes(0), _cont(NULL), _config(cfg)
+    : hdr_loc(TS_NULL_MLOC), url_loc(TS_NULL_MLOC), vc(NULL), _bytes(0), _cont(NULL), _config(cfg),
_scheduled(0)
   {
     mbuf = TSMBufferCreate();
   }
 
   ~BGFetchData()
   {
-    release_url();
+    if (_scheduled) {
+      release_url();
+    }
 
     TSHandleMLocRelease(mbuf, TS_NULL_MLOC, hdr_loc);
     TSHandleMLocRelease(mbuf, TS_NULL_MLOC, url_loc);
@@ -405,6 +409,7 @@ private:
   int64_t _bytes;
   TSCont _cont;
   BGFetchConfig *_config;
+  bool _scheduled;
 };
 
 
@@ -491,6 +496,7 @@ BGFetchData::schedule()
 
   // Schedule
   TSContSchedule(_cont, 0, TS_THREAD_POOL_NET);
+  _scheduled = true;
 }
 
 


Mime
View raw message