summaryrefslogtreecommitdiff
path: root/src/or/config.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-10-23 12:20:58 -0400
committerNick Mathewson <nickm@torproject.org>2017-10-23 12:22:26 -0400
commit48ee85e0c6c83c31693bc58ca4e8e91c8031421d (patch)
tree065423caedd52fc6ca61b572399ecb7782dcb4bf /src/or/config.c
parent8b8d501040946bb2280a9640f91a55b7f17b03e3 (diff)
downloadtor-48ee85e0c6c83c31693bc58ca4e8e91c8031421d.tar.gz
tor-48ee85e0c6c83c31693bc58ca4e8e91c8031421d.zip
Have LOG_PROTOCOL_WARN call its own function
Also, make the function that implements LOG_PROTOCOL_WARN use a cached value of the desired loglevel, rather than calling get_options().
Diffstat (limited to 'src/or/config.c')
-rw-r--r--src/or/config.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 94c4d790ac..a2353b94db 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -1030,6 +1030,23 @@ escaped_safe_str(const char *address)
return escaped(address);
}
+/**
+ * The severity level that should be used for warnings of severity
+ * LOG_PROTOCOL_WARN.
+ *
+ * We keep this outside the options, in case somebody needs to use
+ * LOG_PROTOCOL_WARN while an option transition is happening.
+ */
+static int protocol_warning_severity_level = LOG_WARN;
+
+/** Return the severity level that should be used for warnings of severity
+ * LOG_PROTOCOL_WARN. */
+int
+get_protocol_warning_severity_level(void)
+{
+ return protocol_warning_severity_level;
+}
+
/** List of default directory authorities */
static const char *default_authorities[] = {
@@ -1667,6 +1684,11 @@ options_act(const or_options_t *old_options)
return -1;
}
+ if (options->ProtocolWarnings)
+ protocol_warning_severity_level = LOG_WARN;
+ else
+ protocol_warning_severity_level = LOG_INFO;
+
if (consider_adding_dir_servers(options, old_options) < 0)
return -1;