From 44c8ebb43831dbda399c34980c410565af60dcf2 Mon Sep 17 00:00:00 2001 From: Jennifer Richards Date: Fri, 13 Apr 2018 12:43:25 -0400 Subject: [PATCH] Parse monitoring port from internal configuration --- common/tr_config_internal.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/common/tr_config_internal.c b/common/tr_config_internal.c index 85cd69c..82a57e2 100644 --- a/common/tr_config_internal.c +++ b/common/tr_config_internal.c @@ -146,7 +146,7 @@ do { \ */ TR_CFG_RC tr_cfg_parse_internal(TR_CFG *trc, json_t *jint) { - json_t *jlog = NULL; + json_t *jtmp = NULL; const char *s = NULL; if ((!trc) || (!jint)) @@ -175,20 +175,26 @@ TR_CFG_RC tr_cfg_parse_internal(TR_CFG *trc, json_t *jint) NOPARSE_UNLESS(tr_cfg_parse_unsigned(jint, "tid_response_numerator", &(trc->internal->tid_resp_numer))); NOPARSE_UNLESS(tr_cfg_parse_unsigned(jint, "tid_response_denominator", &(trc->internal->tid_resp_denom))); - if (NULL != (jlog = json_object_get(jint, "logging"))) { - NOPARSE_UNLESS(tr_cfg_parse_string(jlog, "log_threshold", &s)); + /* Parse the logging section */ + if (NULL != (jtmp = json_object_get(jint, "logging"))) { + NOPARSE_UNLESS(tr_cfg_parse_string(jtmp, "log_threshold", &s)); if (s) { trc->internal->log_threshold = str2sev(s); talloc_free((void *) s); } - NOPARSE_UNLESS(tr_cfg_parse_string(jlog, "console_threshold", &s)); + NOPARSE_UNLESS(tr_cfg_parse_string(jtmp, "console_threshold", &s)); if (s) { trc->internal->console_threshold = str2sev(s); talloc_free((void *) s); } } + /* Parse the monitoring section */ + if (NULL != (jtmp = json_object_get(jint, "monitoring"))) { + NOPARSE_UNLESS(tr_cfg_parse_unsigned(jtmp, "port", &(trc->internal->monitoring_port))); + } + tr_debug("tr_cfg_parse_internal: Internal config parsed."); return TR_CFG_SUCCESS; } -- 2.1.4