Skip to content

Commit f0d93dc

Browse files
committed
hostdb: don't use next_sync_time - now() as TTL (it can be negative)
1 parent 986d355 commit f0d93dc

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

iocore/hostdb/HostDB.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,9 +1654,9 @@ HostDBContinuation::do_dns()
16541654
HostsFileMap::iterator find_result = current_host_file_map->hosts_file_map.find(hname);
16551655
if (find_result != current_host_file_map->hosts_file_map.end()) {
16561656
if (action.continuation) {
1657-
// Set the TTL based on how much time remains until the next sync
1657+
// Set the TTL based on how often we stat() the host file
16581658
HostDBInfo *r = lookup_done(IpAddr(find_result->second), hash.host_name, false,
1659-
current_host_file_map->next_sync_time - ink_time(), nullptr);
1659+
hostdb_hostfile_check_interval, nullptr);
16601660
reply_to_cont(action.continuation, r);
16611661
}
16621662
hostdb_cont_free(this);
@@ -2241,7 +2241,6 @@ ParseHostFile(const char *path, unsigned int hostdb_hostfile_check_interval_pars
22412241
int64_t size = info.st_size + 1;
22422242

22432243
parsed_hosts_file_ptr = new RefCountedHostsFileMap;
2244-
parsed_hosts_file_ptr->next_sync_time = ink_time() + hostdb_hostfile_check_interval_parse;
22452244
parsed_hosts_file_ptr->HostFileText = static_cast<char *>(ats_malloc(size));
22462245
if (parsed_hosts_file_ptr->HostFileText) {
22472246
char *base = parsed_hosts_file_ptr->HostFileText;

iocore/hostdb/P_HostDBProcessor.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ typedef std::map<ts::ConstBuffer, IpAddr, CmpConstBuffferCaseInsensitive> HostsF
182182
struct RefCountedHostsFileMap : public RefCountObj {
183183
HostsFileMap hosts_file_map;
184184
ats_scoped_str HostFileText;
185-
ink_time_t next_sync_time; // time of the next sync
186185
};
187186

188187
//

0 commit comments

Comments
 (0)