trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sor...@apache.org
Subject [1/4] trafficserver git commit: TS-3491: background_fetch: Only release URL if we were scheduled
Date Fri, 03 Apr 2015 19:15:47 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/5.3.x 3f9e5b1ef -> 7bfa66647


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

(cherry picked from commit 9f33e9ef88bcab99ebc4d1d5d6d45c2c8cd986da)

Conflicts:
	CHANGES


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

Branch: refs/heads/5.3.x
Commit: 4fc322a2f3038a4761412b12c3807049ab7d098f
Parents: 3f9e5b1
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 12:56:09 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/4fc322a2/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index d3aaf02..6ab80c6 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.3.0
 
+  *) [TS-3491] background_fetch: Only release URL if we were scheduled.
+
   *) [TS-2709] ATS does not send close-notify on shutdown. Confuses some clients.
 
   *) [TS-3467] Cleanup tmp files created from traffic_via tests.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4fc322a2/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