This is an automated email from the ASF dual-hosted git repository. shinrich pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push: new 067ff89 hostdb: don't use next_sync_time - now() as TTL (it can be negative) (#6979) 067ff89 is described below commit 067ff8963dc90b2275445cc1af08f95dcd7fe67c Author: Joe Landers <j...@joelanders.net> AuthorDate: Fri Jul 10 20:25:38 2020 +0200 hostdb: don't use next_sync_time - now() as TTL (it can be negative) (#6979) --- iocore/hostdb/HostDB.cc | 10 ++++------ iocore/hostdb/P_HostDBProcessor.h | 1 - 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc index f06a39c..2fa10fc 100644 --- a/iocore/hostdb/HostDB.cc +++ b/iocore/hostdb/HostDB.cc @@ -1654,9 +1654,8 @@ HostDBContinuation::do_dns() HostsFileMap::iterator find_result = current_host_file_map->hosts_file_map.find(hname); if (find_result != current_host_file_map->hosts_file_map.end()) { if (action.continuation) { - // Set the TTL based on how much time remains until the next sync - HostDBInfo *r = lookup_done(IpAddr(find_result->second), hash.host_name, false, - current_host_file_map->next_sync_time - ink_time(), nullptr); + // Set the TTL based on how often we stat() the host file + HostDBInfo *r = lookup_done(IpAddr(find_result->second), hash.host_name, false, hostdb_hostfile_check_interval, nullptr); reply_to_cont(action.continuation, r); } hostdb_cont_free(this); @@ -2240,9 +2239,8 @@ ParseHostFile(const char *path, unsigned int hostdb_hostfile_check_interval_pars // +1 in case no terminating newline int64_t size = info.st_size + 1; - parsed_hosts_file_ptr = new RefCountedHostsFileMap; - parsed_hosts_file_ptr->next_sync_time = ink_time() + hostdb_hostfile_check_interval_parse; - parsed_hosts_file_ptr->HostFileText = static_cast<char *>(ats_malloc(size)); + parsed_hosts_file_ptr = new RefCountedHostsFileMap; + parsed_hosts_file_ptr->HostFileText = static_cast<char *>(ats_malloc(size)); if (parsed_hosts_file_ptr->HostFileText) { char *base = parsed_hosts_file_ptr->HostFileText; char *limit; diff --git a/iocore/hostdb/P_HostDBProcessor.h b/iocore/hostdb/P_HostDBProcessor.h index ac14387..b903049 100644 --- a/iocore/hostdb/P_HostDBProcessor.h +++ b/iocore/hostdb/P_HostDBProcessor.h @@ -182,7 +182,6 @@ typedef std::map<ts::ConstBuffer, IpAddr, CmpConstBuffferCaseInsensitive> HostsF struct RefCountedHostsFileMap : public RefCountObj { HostsFileMap hosts_file_map; ats_scoped_str HostFileText; - ink_time_t next_sync_time; // time of the next sync }; //