You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2015/04/03 19:42:15 UTC
[1/2] trafficserver git commit: TS-3491: background_fetch: Only
release URL if we were scheduled
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 <Jo...@cable.comcast.com>
Authored: Fri Apr 3 11:35:58 2015 -0600
Committer: Phil Sorber <so...@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;
}
[2/2] trafficserver git commit: TS-3491: background_fetch: We don't
need the extra variable. We can tell if we were scheduled from the _cont.
Posted by so...@apache.org.
TS-3491: background_fetch: We don't need the extra variable. We can
tell if we were scheduled from the _cont.
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/6fbe03ad
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/6fbe03ad
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/6fbe03ad
Branch: refs/heads/master
Commit: 6fbe03ad1b110640faa4f39ef26b1657c4ee19b7
Parents: 9f33e9e
Author: Leif Hedstrom <zw...@apache.org>
Authored: Fri Apr 3 11:40:55 2015 -0600
Committer: Phil Sorber <so...@apache.org>
Committed: Fri Apr 3 11:40:59 2015 -0600
----------------------------------------------------------------------
.../experimental/background_fetch/background_fetch.cc | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/6fbe03ad/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 06bd076..964624e 100644
--- a/plugins/experimental/background_fetch/background_fetch.cc
+++ b/plugins/experimental/background_fetch/background_fetch.cc
@@ -334,16 +334,13 @@ 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), _scheduled(0)
+ : hdr_loc(TS_NULL_MLOC), url_loc(TS_NULL_MLOC), vc(NULL), _bytes(0), _cont(NULL), _config(cfg)
{
mbuf = TSMBufferCreate();
}
~BGFetchData()
{
- if (_scheduled) {
- release_url();
- }
TSHandleMLocRelease(mbuf, TS_NULL_MLOC, hdr_loc);
TSHandleMLocRelease(mbuf, TS_NULL_MLOC, url_loc);
@@ -358,8 +355,10 @@ struct BGFetchData {
// If we got schedule, also clean that up
if (_cont) {
- TSContDestroy(_cont);
+ release_url();
+ TSContDestroy(_cont);
+ _cont = NULL;
TSIOBufferReaderFree(req_io_buf_reader);
TSIOBufferDestroy(req_io_buf);
TSIOBufferReaderFree(resp_io_buf_reader);
@@ -409,7 +408,6 @@ private:
int64_t _bytes;
TSCont _cont;
BGFetchConfig *_config;
- bool _scheduled;
};
@@ -496,7 +494,6 @@ BGFetchData::schedule()
// Schedule
TSContSchedule(_cont, 0, TS_THREAD_POOL_NET);
- _scheduled = true;
}