trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sor...@apache.org
Subject [2/4] trafficserver git commit: TS-3491: background_fetch: We don't need the extra variable. We can tell if we were scheduled from the _cont.
Date Fri, 03 Apr 2015 19:15:48 GMT
TS-3491: background_fetch: We don't need the extra variable. We can
         tell if we were scheduled from the _cont.

(cherry picked from commit 6fbe03ad1b110640faa4f39ef26b1657c4ee19b7)


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

Branch: refs/heads/5.3.x
Commit: 56013a631b5165dabc7d8efef9c4761f858cd513
Parents: 4fc322a
Author: Leif Hedstrom <zwoop@apache.org>
Authored: Fri Apr 3 11:40:55 2015 -0600
Committer: Phil Sorber <sorber@apache.org>
Committed: Fri Apr 3 12:56:15 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/56013a63/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;
 }
 
 


Mime
View raw message