You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2022/08/23 17:23:50 UTC
[trafficserver] branch 9.2.x updated: utilize proxy.config.hostdb.host_file.interval config variable (#9039)
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/9.2.x by this push:
new c3f1b51a0 utilize proxy.config.hostdb.host_file.interval config variable (#9039)
c3f1b51a0 is described below
commit c3f1b51a06c7477526a759deaa82c28be76ff37d
Author: Chris McFarlen <ch...@mcfarlen.us>
AuthorDate: Tue Aug 16 13:55:36 2022 -0500
utilize proxy.config.hostdb.host_file.interval config variable (#9039)
(cherry picked from commit 60a91e6b96e914ad3fb5c43c5917cdf0ee8e21d1)
---
iocore/hostdb/HostDB.cc | 11 +++++++++++
iocore/hostdb/P_HostDBProcessor.h | 3 +++
2 files changed, 14 insertions(+)
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index e39b8fcc5..0a4a0352c 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -422,6 +422,7 @@ HostDBProcessor::start(int, size_t)
HostDBContinuation *b = hostDBContAllocator.alloc();
SET_CONTINUATION_HANDLER(b, (HostDBContHandler)&HostDBContinuation::backgroundEvent);
b->mutex = new_ProxyMutex();
+ b->updateHostFileConfig();
eventProcessor.schedule_every(b, HRTIME_SECONDS(1), ET_DNS);
return 0;
@@ -1636,6 +1637,15 @@ HostDBContinuation::do_dns()
}
}
+void
+HostDBContinuation::updateHostFileConfig()
+{
+ RecInt tmp_interval{};
+
+ REC_ReadConfigInteger(tmp_interval, "proxy.config.hostdb.host_file.interval");
+ hostdb_hostfile_check_interval = std::chrono::seconds(tmp_interval);
+}
+
//
// Background event
// Just increment the current_interval. Might do other stuff
@@ -1656,6 +1666,7 @@ HostDBContinuation::backgroundEvent(int /* event ATS_UNUSED */, Event * /* e ATS
struct stat info;
char path[sizeof(hostdb_hostfile_path)];
+ updateHostFileConfig();
REC_ReadConfigString(path, "proxy.config.hostdb.host_file.path", sizeof(path));
if (0 != strcasecmp(hostdb_hostfile_path, path)) {
Debug("hostdb", "Update host file '%s' -> '%s'", (*hostdb_hostfile_path ? hostdb_hostfile_path : "*-none-*"),
diff --git a/iocore/hostdb/P_HostDBProcessor.h b/iocore/hostdb/P_HostDBProcessor.h
index 7a05013c7..76b3155f0 100644
--- a/iocore/hostdb/P_HostDBProcessor.h
+++ b/iocore/hostdb/P_HostDBProcessor.h
@@ -462,6 +462,9 @@ struct HostDBContinuation : public Continuation {
int retryEvent(int event, Event *e);
int setbyEvent(int event, Event *e);
+ // update the host file config variables
+ void updateHostFileConfig();
+
/// Recompute the hash and update ancillary values.
void refresh_hash();
void do_dns();