trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject svn commit: r1103588 - in /trafficserver/traffic/trunk/proxy/http/remap: RemapPlugins.cc RemapPlugins.h RemapProcessor.cc
Date Mon, 16 May 2011 00:46:52 GMT
Author: zwoop
Date: Mon May 16 00:46:51 2011
New Revision: 1103588

URL: http://svn.apache.org/viewvc?rev=1103588&view=rev
Log:
TS-784 Don not use class allocator for remap processing when no remap threads are enabled

Modified:
    trafficserver/traffic/trunk/proxy/http/remap/RemapPlugins.cc
    trafficserver/traffic/trunk/proxy/http/remap/RemapPlugins.h
    trafficserver/traffic/trunk/proxy/http/remap/RemapProcessor.cc

Modified: trafficserver/traffic/trunk/proxy/http/remap/RemapPlugins.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/remap/RemapPlugins.cc?rev=1103588&r1=1103587&r2=1103588&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/remap/RemapPlugins.cc (original)
+++ trafficserver/traffic/trunk/proxy/http/remap/RemapPlugins.cc Mon May 16 00:46:51 2011
@@ -30,9 +30,9 @@ RemapPlugins::run_plugin(remap_plugin_in
 {
   TSRemapStatus plugin_retcode;
   TSRemapRequestInfo rri;
-  url_mapping *map = _map_container->getMapping();
+  url_mapping *map = _s->url_map.getMapping();
   URL *map_from = &(map->fromURL);
-  URL *map_to = _map_container->getToURL();
+  URL *map_to = _s->url_map.getToURL();
 
   // This is the equivalent of TSHttpTxnClientReqGet(), which every remap plugin would
   // have to call.
@@ -104,9 +104,9 @@ RemapPlugins::run_single_remap()
 
   const char *requestPath;
   int requestPathLen;
-  url_mapping *map = _map_container->getMapping();
+  url_mapping *map = _s->url_map.getMapping();
   URL *map_from = &(map->fromURL);
-  URL *map_to = _map_container->getToURL();
+  URL *map_to = _s->url_map.getToURL();
 
   int redirect_host_len;
 

Modified: trafficserver/traffic/trunk/proxy/http/remap/RemapPlugins.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/remap/RemapPlugins.h?rev=1103588&r1=1103587&r2=1103588&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/remap/RemapPlugins.h (original)
+++ trafficserver/traffic/trunk/proxy/http/remap/RemapPlugins.h Mon May 16 00:46:51 2011
@@ -42,16 +42,19 @@
 **/
 struct RemapPlugins: public Continuation
 {
-  RemapPlugins()
-    : _cur(0)
+ RemapPlugins()
+   : _cur(0)
+    { }
+
+ RemapPlugins(HttpTransact::State* s, URL* u, HTTPHdr* h, host_hdr_info* hi)
+   : _cur(0), _s(s), _request_url(u), _request_header(h), _hh_ptr(hi)
     { }
 
   ~RemapPlugins() { _cur = 0; }
 
   // Some basic setters
-  void setMap(UrlMappingContainer* m) { _map_container = m; }
-  void setRequestUrl(URL* u) { _request_url = u; }
   void setState(HttpTransact::State* state) { _s = state; }
+  void setRequestUrl(URL* u) { _request_url = u; }
   void setRequestHeader(HTTPHdr* h) {  _request_header = h; }
   void setHostHeaderInfo(host_hdr_info* h) { _hh_ptr = h; }
 
@@ -63,10 +66,9 @@ struct RemapPlugins: public Continuation
 
  private:
   unsigned int _cur;
-  UrlMappingContainer *_map_container;
+  HttpTransact::State * _s;
   URL *_request_url;
   HTTPHdr *_request_header;
-  HttpTransact::State * _s;
   host_hdr_info *_hh_ptr;
 };
 

Modified: trafficserver/traffic/trunk/proxy/http/remap/RemapProcessor.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/remap/RemapProcessor.cc?rev=1103588&r1=1103587&r2=1103588&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/remap/RemapProcessor.cc (original)
+++ trafficserver/traffic/trunk/proxy/http/remap/RemapProcessor.cc Mon May 16 00:46:51 2011
@@ -294,30 +294,30 @@ RemapProcessor::perform_remap(Continuati
     return ACTION_RESULT_DONE;
   }
 
-  // EThread *t = cont->mutex->thread_holding;
-  // RemapPlugins *plugins = THREAD_ALLOC_INIT(pluginAllocator, t);
+  if (_use_separate_remap_thread) {
+    RemapPlugins *plugins = pluginAllocator.alloc();
 
-  RemapPlugins *plugins = pluginAllocator.alloc();
+    plugins->setState(s);
+    plugins->setRequestUrl(request_url);
+    plugins->setRequestHeader(request_header);
+    plugins->setHostHeaderInfo(hh_info);
 
-  plugins->setMap(&(s->url_map));
-  plugins->setRequestUrl(request_url);
-  plugins->setRequestHeader(request_header);
-  plugins->setState(s);
-  plugins->setHostHeaderInfo(hh_info);
-
-  if (!_use_separate_remap_thread) {    // lets not schedule anything on our thread group
(ET_REMAP), instead, just execute inline
-    int ret = 0;
-    do {
-      ret = plugins->run_single_remap();
-    } while (ret == 0);
-    pluginAllocator.free(plugins);
-    return ACTION_RESULT_DONE;
-  } else {
+    // Execute "inline" if not using separate remap threads.
     ink_debug_assert(cont->mutex->thread_holding == this_ethread());
     plugins->mutex = cont->mutex;
     plugins->action = cont;
     SET_CONTINUATION_HANDLER(plugins, &RemapPlugins::run_remap);
     eventProcessor.schedule_imm(plugins, ET_REMAP);
+
     return &plugins->action;
+  } else {
+    RemapPlugins plugins(s, request_url, request_header, hh_info);
+    int ret = 0;
+
+    do {
+      ret = plugins.run_single_remap();
+    } while (ret == 0);
+
+    return ACTION_RESULT_DONE;
   }
 }



Mime
View raw message