You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2015/07/24 09:51:51 UTC

trafficserver git commit: Revert "TS-3729 cache_promote: defer TSHttpTxnServerRespNoStoreSet() to a global continuation, saves a possible race condition"

Repository: trafficserver
Updated Branches:
  refs/heads/master a43a1249c -> c14f87437


Revert "TS-3729 cache_promote: defer TSHttpTxnServerRespNoStoreSet() to a global continuation, saves a possible race condition"

This reverts commit 3678a6e11b53520c35d06c7d8baed79f43f812e2.

I have no idea what happened here, but it seems tangled with the Luajit commit
for reason. Going to try it again.


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

Branch: refs/heads/master
Commit: c14f874378383b6abaef0238097a066b4f900f90
Parents: a43a124
Author: Leif Hedstrom <zw...@apache.org>
Authored: Fri Jul 24 01:51:00 2015 -0600
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Fri Jul 24 01:51:38 2015 -0600

----------------------------------------------------------------------
 .../experimental/cache_promote/cache_promote.cc | 25 +++++---------------
 1 file changed, 6 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c14f8743/plugins/experimental/cache_promote/cache_promote.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/cache_promote/cache_promote.cc b/plugins/experimental/cache_promote/cache_promote.cc
index dab961d..9c2edb6 100644
--- a/plugins/experimental/cache_promote/cache_promote.cc
+++ b/plugins/experimental/cache_promote/cache_promote.cc
@@ -34,8 +34,6 @@
 
 
 static const char *PLUGIN_NAME = "cache_promote";
-TSCont gNocacheCont;
-
 
 //////////////////////////////////////////////////////////////////////////////////////////////
 // Note that all options for all policies has to go here. Not particularly pretty...
@@ -374,20 +372,6 @@ private:
 
 
 //////////////////////////////////////////////////////////////////////////////////////////////
-// Little helper continuation, to turn off writing to the cache. ToDo: when we have proper
-// APIs to make requests / responses, we can remove this completely.
-static int
-cont_nocache_response(TSCont contp, TSEvent event, void *edata)
-{
-  TSHttpTxn txnp = static_cast<TSHttpTxn>(edata);
-
-  TSHttpTxnServerRespNoStoreSet(txnp, 1);
-  // Reenable and continue with the state machine.
-  TSHttpTxnReenable(txnp, TS_EVENT_HTTP_CONTINUE);
-  return 0;
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////////
 // Main "plugin", a TXN hook in the TS_HTTP_READ_CACHE_HDR_HOOK. Unless the policy allows
 // caching, we will turn off the cache from here on for the TXN.
 //
@@ -415,7 +399,7 @@ cont_handle_policy(TSCont contp, TSEvent event, void *edata)
             TSDebug(PLUGIN_NAME, "cache-status is %d, and leaving cache on (promoted)", obj_status);
           } else {
             TSDebug(PLUGIN_NAME, "cache-status is %d, and turning off the cache (not promoted)", obj_status);
-            TSHttpTxnHookAdd(txnp, TS_HTTP_READ_RESPONSE_HDR_HOOK, gNocacheCont);
+            TSHttpTxnHookAdd(txnp, TS_HTTP_READ_RESPONSE_HDR_HOOK, contp);
           }
           break;
         default:
@@ -429,6 +413,11 @@ cont_handle_policy(TSCont contp, TSEvent event, void *edata)
     }
     break;
 
+  // Temporaray hack, to deal with the fact that we can turn off the cache earlier
+  case TS_EVENT_HTTP_READ_RESPONSE_HDR:
+    TSHttpTxnServerRespNoStoreSet(txnp, 1);
+    break;
+
   // Should not happen
   default:
     TSDebug(PLUGIN_NAME, "Unhandled event %d", (int)event);
@@ -458,8 +447,6 @@ TSRemapInit(TSRemapInterface *api_info, char *errbuf, int errbuf_size)
     return TS_ERROR;
   }
 
-  gNocacheCont = TSContCreate(cont_nocache_response, NULL);
-
   TSDebug(PLUGIN_NAME, "remap plugin is successfully initialized");
   return TS_SUCCESS; /* success */
 }