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 2018/10/08 23:35:23 UTC
[trafficserver] branch 7.1.x updated: turn the binding binding into
a static LogConfig entity
This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 7.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/7.1.x by this push:
new 1b1a1eb turn the binding binding into a static LogConfig entity
1b1a1eb is described below
commit 1b1a1ebfcd1e96d3d53820e9e831aa324a7ab5f4
Author: Brian Olsen <br...@comcast.com>
AuthorDate: Mon Sep 17 21:48:53 2018 +0000
turn the binding binding into a static LogConfig entity
---
proxy/logging/LogConfig.cc | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/proxy/logging/LogConfig.cc b/proxy/logging/LogConfig.cc
index 86ed11b..6e4257a 100644
--- a/proxy/logging/LogConfig.cc
+++ b/proxy/logging/LogConfig.cc
@@ -261,6 +261,20 @@ LogConfig::read_configuration_variables()
}
}
+static BindingInstance *binding = nullptr;
+
+static void
+setup_bindings()
+{
+ if (nullptr == binding) {
+ binding = new BindingInstance;
+ ink_assert(nullptr != binding);
+
+ bool const constructed = binding->construct();
+ ink_assert(constructed);
+ }
+}
+
/*-------------------------------------------------------------------------
LogConfig::LogConfig
@@ -288,6 +302,7 @@ LogConfig::LogConfig()
// a LogConfig object is valid upon return from the constructor even
// if no configuration file is read
//
+ setup_bindings();
setup_default_values();
}
@@ -915,15 +930,14 @@ LogConfig::update_space_used()
bool
LogConfig::evaluate_config()
{
- BindingInstance binding;
ats_scoped_str path(RecConfigReadConfigPath("proxy.config.log.config.filename", "logging.config"));
- if (!binding.construct()) {
+ if (nullptr == binding) {
Fatal("failed to initialize Lua runtime");
}
- if (MakeLogBindings(binding, this)) {
- return binding.require(path.get());
+ if (MakeLogBindings(*binding, this)) {
+ return binding->require(path.get());
}
return false;