trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject svn commit: r1180257 - in /trafficserver/traffic/trunk: lib/ts/ink_queue.cc lib/ts/ink_queue.h proxy/http/HttpTransact.cc
Date Fri, 07 Oct 2011 21:53:54 GMT
Author: zwoop
Date: Fri Oct  7 21:53:53 2011
New Revision: 1180257

URL: http://svn.apache.org/viewvc?rev=1180257&view=rev
Log:
TS-567 Remove CHECK_FOR_DOUBLE_FREE now that we have debuggable mallocs

Modified:
    trafficserver/traffic/trunk/lib/ts/ink_queue.cc
    trafficserver/traffic/trunk/lib/ts/ink_queue.h
    trafficserver/traffic/trunk/proxy/http/HttpTransact.cc

Modified: trafficserver/traffic/trunk/lib/ts/ink_queue.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/ink_queue.cc?rev=1180257&r1=1180256&r2=1180257&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/ink_queue.cc (original)
+++ trafficserver/traffic/trunk/lib/ts/ink_queue.cc Fri Oct  7 21:53:53 2011
@@ -126,12 +126,9 @@ ink_freelist_init(InkFreeList * f,
 #if defined(INK_USE_MUTEX_FOR_FREELISTS)
   ink_mutex_init(&(f->inkfreelist_mutex), name);
 #endif
-#if (defined(USE_SPINLOCK_FOR_FREELIST) || defined(CHECK_FOR_DOUBLE_FREE))
+#if defined(USE_SPINLOCK_FOR_FREELIST)
   ink_mutex_init(&(f->freelist_mutex), name);
   f->head = NULL;
-#ifdef CHECK_FOR_DOUBLE_FREE
-  f->tail = NULL;
-#endif
 #else
   SET_FREELIST_POINTER_VERSION(f->head, FROM_PTR(0), 0);
 #endif
@@ -168,7 +165,7 @@ ink_freelist_new(InkFreeList * f)
 #endif                          /* !INK_USE_MUTEX_FOR_FREELISTS */
 {                               //static uint32_t cntf = 0;
 
-#if (defined(USE_SPINLOCK_FOR_FREELIST) || defined(CHECK_FOR_DOUBLE_FREE))
+#if defined(USE_SPINLOCK_FOR_FREELIST)
   void *foo;
   uint32_t type_size = f->type_size;
 
@@ -183,10 +180,6 @@ ink_freelist_new(InkFreeList * f)
      * We have something on the free list..
      */
     void_p *h = (void_p *) f->head;
-#ifdef CHECK_FOR_DOUBLE_FREE
-    if (f->head == f->tail)
-      f->tail = NULL;
-#endif /* CHECK_FOR_DOUBLE_FREE */
 
     foo = (void *) h;
     f->head = (volatile void_p *) *h;
@@ -227,7 +220,7 @@ ink_freelist_new(InkFreeList * f)
     return foo;
   }
 
-#else /* #if (defined(USE_SPINLOCK_FOR_FREELIST) || defined(CHECK_FOR_DOUBLE_FREE)) */
+#else /* #if (defined(USE_SPINLOCK_FOR_FREELIST) */
   head_p item;
   head_p next;
   int result = 0;
@@ -330,7 +323,7 @@ ink_freelist_new(InkFreeList * f)
   ink_atomic_increment64(&fastalloc_mem_in_use, (int64_t) f->type_size);
 
   return TO_PTR(FREELIST_POINTER(item));
-#endif /* #if (defined(USE_SPINLOCK_FOR_FREELIST) || defined(CHECK_FOR_DOUBLE_FREE)) */
+#endif /* #if (defined(USE_SPINLOCK_FOR_FREELIST) */
 }
 typedef volatile void *volatile_void_p;
 
@@ -342,32 +335,15 @@ void
 ink_freelist_free(InkFreeList * f, void *item)
 #endif                          /* !INK_USE_MUTEX_FOR_FREELISTS */
 {
-#if (defined(USE_SPINLOCK_FOR_FREELIST) || defined(CHECK_FOR_DOUBLE_FREE))
+#if defined(USE_SPINLOCK_FOR_FREELIST)
   void_p *foo;
 
   //printf("ink_freelist_free\n");
   ink_mutex_acquire(&(f->freelist_mutex));
 
   foo = (void_p *) item;
-#ifdef CHECK_FOR_DOUBLE_FREE
-  void_p *p = (void_p *) f->head;
-  while (p) {
-    if (p == (void_p *) item)
-      ink_release_assert(!"ink_freelist_free: Double free");
-    p = (void_p *) * p;
-  }
-
-  if (f->tail)
-    *f->tail = foo;
-  *foo = (void_p) NULL;
-
-  if (f->head == NULL)
-    f->head = foo;
-  f->tail = foo;
-#else
   *foo = (void_p) f->head;
   f->head = foo;
-#endif
   f->count -= 1;
 
   ink_mutex_release(&(f->freelist_mutex));

Modified: trafficserver/traffic/trunk/lib/ts/ink_queue.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/ink_queue.h?rev=1180257&r1=1180256&r2=1180257&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/ink_queue.h (original)
+++ trafficserver/traffic/trunk/lib/ts/ink_queue.h Fri Oct  7 21:53:53 2011
@@ -59,7 +59,6 @@
 */
 
 /* #define USE_SPINLOCK_FOR_FREELIST */
-/* #define CHECK_FOR_DOUBLE_FREE */
 
 #ifdef __cplusplus
 extern "C"
@@ -123,19 +122,16 @@ extern "C"
 
   typedef struct
   {
-#if (defined(INK_USE_MUTEX_FOR_FREELISTS) || defined(CHECK_FOR_DOUBLE_FREE))
+#if defined(INK_USE_MUTEX_FOR_FREELISTS)
     ink_mutex inkfreelist_mutex;
 #endif
-#if (defined(USE_SPINLOCK_FOR_FREELIST) || defined(CHECK_FOR_DOUBLE_FREE))
+#if defined(USE_SPINLOCK_FOR_FREELIST)
     /*
       This assumes  we will never use anything other than Pthreads
       on alpha
     */
     ink_mutex freelist_mutex;
     volatile void_p *head;
-#ifdef CHECK_FOR_DOUBLE_FREE
-    volatile void_p *tail;
-#endif
 #else
     volatile head_p head;
 #endif

Modified: trafficserver/traffic/trunk/proxy/http/HttpTransact.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/http/HttpTransact.cc?rev=1180257&r1=1180256&r2=1180257&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/http/HttpTransact.cc (original)
+++ trafficserver/traffic/trunk/proxy/http/HttpTransact.cc Fri Oct  7 21:53:53 2011
@@ -2303,7 +2303,6 @@ HttpTransact::HandleCacheOpenReadHitFres
 void
 HttpTransact::CallOSDNSLookup(State* s)
 {
-//printf("into HttpTransact::CallOSDNSLookup **\n");
   TRANSACT_RETURN(DNS_LOOKUP, OSDNSLookup);
 }
 
@@ -2717,10 +2716,8 @@ HttpTransact::build_response_from_cache(
       // only if the cached response is a 200 OK
       if (client_response_code == HTTP_STATUS_OK && client_request->presence(MIME_PRESENCE_RANGE))
{
         s->state_machine->do_range_setup_if_necessary();
-        if (s->range_setup == RANGE_NOT_SATISFIABLE &&
-            s->http_config_param->reverse_proxy_enabled) {
+        if (s->range_setup == RANGE_NOT_SATISFIABLE && s->http_config_param->reverse_proxy_enabled)
{
           build_error_response(s, HTTP_STATUS_RANGE_NOT_SATISFIABLE, "Requested Range Not
Satisfiable","","");
-
           s->cache_info.action = CACHE_DO_NO_ACTION;
           s->next_action = PROXY_INTERNAL_CACHE_NOOP;
           break;
@@ -4108,7 +4105,6 @@ HttpTransact::handle_cache_operation_on_
 
     } else if (s->cache_info.action == CACHE_DO_UPDATE && is_request_conditional(&s->hdr_info.server_request))
{
       // CACHE_DO_UPDATE and server response is cacheable
-
       if (is_request_conditional(&s->hdr_info.client_request)) {
         if (s->txn_conf->cache_when_to_revalidate != 4)
           client_response_code =
@@ -4132,12 +4128,25 @@ HttpTransact::handle_cache_operation_on_
           base_response = &s->hdr_info.server_response;
         }
       } else {
-        if (s->method == HTTP_WKSIDX_HEAD) {
-          s->cache_info.action = CACHE_DO_UPDATE;
-          s->next_action = SERVER_READ;
+        if (s->hdr_info.client_request.presence(MIME_PRESENCE_RANGE)) {
+          s->state_machine->do_range_setup_if_necessary();
+          if (s->range_setup == RANGE_NOT_SATISFIABLE || s->range_setup == RANGE_NOT_HANDLED)
{
+            base_response = &s->hdr_info.server_response;
+            build_error_response(s, HTTP_STATUS_RANGE_NOT_SATISFIABLE, "Requested Range Not
Satisfiable","","");
+            s->cache_info.action = CACHE_DO_NO_ACTION;
+            s->next_action = PROXY_INTERNAL_CACHE_NOOP;
+          } else {
+            s->cache_info.action = CACHE_DO_SERVE_AND_UPDATE;
+            s->next_action = SERVE_FROM_CACHE;
+          }
         } else {
-          s->cache_info.action = CACHE_DO_SERVE_AND_UPDATE;
-          s->next_action = SERVE_FROM_CACHE;
+          if (s->method == HTTP_WKSIDX_HEAD) {
+            s->cache_info.action = CACHE_DO_UPDATE;
+            s->next_action = SERVER_READ;
+          } else {
+            s->cache_info.action = CACHE_DO_SERVE_AND_UPDATE;
+            s->next_action = SERVE_FROM_CACHE;
+          }
         }
         /* base_response will be set after updating headers below */
       }



Mime
View raw message