do not open listening ports when [web].mode = none; fixes #2088
Costa Tsaousis (ktsaou) committed
Apr 18, 2017 at 20:14 UTC
6318534a27cb9f22b475d0bbae756822b6184d32
1 file changed
+8
-4
src/main.c
+8
-4
@@ -66,14 +66,16 @@ void web_server_threading_selection(void) {
66
int single_threaded = (web_server_mode == WEB_SERVER_MODE_SINGLE_THREADED);
67
68
int i;
69
- for(i = 0; static_threads[i].name ; i++) {
70
- if(static_threads[i].start_routine == socket_listen_main_multi_threaded)
69
+ for (i = 0; static_threads[i].name; i++) {
70
+ if (static_threads[i].start_routine == socket_listen_main_multi_threaded)
71
static_threads[i].enabled = multi_threaded;
72
73
- if(static_threads[i].start_routine == socket_listen_main_single_threaded)
73
+ if (static_threads[i].start_routine == socket_listen_main_single_threaded)
74
static_threads[i].enabled = single_threaded;
75
}
76
+}
77
78
+void web_server_config_options(void) {
79
web_client_timeout = (int) config_get_number(CONFIG_SECTION_WEB, "disconnect idle clients after seconds", DEFAULT_DISCONNECT_IDLE_WEB_CLIENTS_AFTER_SECONDS);
80
81
respect_web_browser_do_not_track_policy = config_get_boolean(CONFIG_SECTION_WEB, "respect do not track policy", respect_web_browser_do_not_track_policy);
@@ -915,6 +917,8 @@ int main(int argc, char **argv) {
917
// --------------------------------------------------------------------
918
// create the listening sockets
919
920
+ web_server_threading_selection();
921
+
922
if(web_server_mode != WEB_SERVER_MODE_NONE)
923
create_listen_sockets();
924
}
@@ -968,7 +972,7 @@ int main(int argc, char **argv) {
972
// ------------------------------------------------------------------------
973
// spawn the threads
974
971
- web_server_threading_selection();
975
+ web_server_config_options();
976
977
for (i = 0; static_threads[i].name != NULL ; i++) {
978
struct netdata_static_thread *st = &static_threads[i];