You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by GitBox <gi...@apache.org> on 2022/10/06 16:45:43 UTC

[GitHub] [trafficserver] randall commented on a diff in pull request #9046: Fix hosting.config reload

randall commented on code in PR #9046:
URL: https://github.com/apache/trafficserver/pull/9046#discussion_r989274674


##########
iocore/cache/P_CacheHosting.h:
##########
@@ -152,23 +261,34 @@ class CacheHostTable
 struct CacheHostTableConfig;
 typedef int (CacheHostTableConfig::*CacheHostTabHandler)(int, void *);
 struct CacheHostTableConfig : public Continuation {
-  CacheHostTable **ppt;
-  CacheHostTableConfig(CacheHostTable **appt) : Continuation(nullptr), ppt(appt)
+  CacheHostTableConfig(ReplaceablePtr<CacheHostTable> *appt) : Continuation(nullptr), ppt(appt)
   {
     SET_HANDLER((CacheHostTabHandler)&CacheHostTableConfig::mainEvent);
   }
 
+  ~CacheHostTableConfig() {}
+
   int
   mainEvent(int event, Event *e)
   {
     (void)e;
     (void)event;
-    CacheHostTable *t   = new CacheHostTable((*ppt)->cache, (*ppt)->type);
-    CacheHostTable *old = (CacheHostTable *)ink_atomic_swap(&t, *ppt);
-    new_Deleter(old, CACHE_MEM_FREE_TIMEOUT);
+
+    CacheType type = CACHE_HTTP_TYPE;
+    Cache *cache   = nullptr;
+    {
+      ReplaceablePtr<CacheHostTable>::ScopedReader hosttable(ppt);
+      type  = hosttable->type;
+      cache = hosttable->cache;
+    }
+    ppt->reset(new CacheHostTable(cache, type));
+    // new_Deleter(old, CACHE_MEM_FREE_TIMEOUT);

Review Comment:
   remove commented out code.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org