trafficserver-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bgaff <...@git.apache.org>
Subject [GitHub] trafficserver pull request: Maintain and use a mapping of hostname...
Date Fri, 03 Jul 2015 02:08:37 GMT
Github user bgaff commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/240#discussion_r33836997
  
    --- Diff: iocore/hostdb/HostDB.cc ---
    @@ -2833,15 +2650,8 @@ ParseHostFile(char const *path)
         }
       }
     
    -  if (!HostFilePairs.empty()) {
    -    // Need to sort by name so multiple address hosts are
    -    // contiguous.
    -    std::sort(HostFilePairs.begin(), HostFilePairs.end(), &CmpHostFilePair);
    -    HostDBFileContinuation::scheduleUpdate(0);
    -  } else if (!HostFileKeys.empty()) {
    -    HostDBFileContinuation::scheduleRemove(-1, 0);
    -  } else {
    -    // Nothing in new data, nothing in old data, just clean up.
    -    HostDBFileContinuation::finish(0);
    -  }
    +  // Swap out hostDB's map for ours
    +  hostDB.hosts_file_ptr = parsed_hosts_file_ptr;
    +  // Make a new map, so we can do it all again
    +  parsed_hosts_file_ptr = new RefCountedHostsFileMap();
    --- End diff --
    
    I had the same question when I saw that, and it's likely others will wonder the same thing
looking at this code in the future. It might be clearer if you do it at the start rather than
at the completion of parsing.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message