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 <[email protected]>
Authored: Fri Apr 3 11:40:55 2015 -0600
Committer: Phil Sorber <[email protected]>
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;
}