diff --git a/.gitignore b/.gitignore index 6177c41..25939d8 100644 --- a/.gitignore +++ b/.gitignore @@ -83,3 +83,4 @@ Thumbs.db # -------- *.dll *.exe +.cache/* diff --git a/src/apps/relay/mainrelay.c b/src/apps/relay/mainrelay.c index bfc39e6..3185a7e 100644 --- a/src/apps/relay/mainrelay.c +++ b/src/apps/relay/mainrelay.c @@ -2214,7 +2214,7 @@ static void set_option(int c, char *value) { break; #endif case PROMETHEUS_OPT: - turn_params.prometheus = 1; + turn_params.prometheus = true; break; case PROMETHEUS_PORT_OPT: turn_params.prometheus_port = atoi(value); @@ -2226,7 +2226,7 @@ static void set_option(int c, char *value) { STRCPY(turn_params.prometheus_path, value); break; case PROMETHEUS_ENABLE_USERNAMES_OPT: - turn_params.prometheus_username_labels = 1; + turn_params.prometheus_username_labels = true; break; case AUTH_SECRET_OPT: turn_params.use_auth_secret_with_timestamp = 1; diff --git a/src/apps/relay/prom_server.c b/src/apps/relay/prom_server.c index ab21bd1..7e54444 100644 --- a/src/apps/relay/prom_server.c +++ b/src/apps/relay/prom_server.c @@ -112,7 +112,7 @@ MHD_RESULT promhttp_handler(void *cls, struct MHD_Connection *connection, const } void start_prometheus_server(void) { - if (turn_params.prometheus == 0) { + if (!turn_params.prometheus) { TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "prometheus collector disabled, not started\n"); return; } @@ -238,7 +238,7 @@ void start_prometheus_server(void) { void prom_set_finished_traffic(const char *realm, const char *user, unsigned long rsvp, unsigned long rsvb, unsigned long sentp, unsigned long sentb, bool peer) { - if (turn_params.prometheus == 1) { + if (turn_params.prometheus) { const char *label[] = {realm, NULL}; if (turn_params.prometheus_username_labels) { @@ -270,33 +270,33 @@ void prom_set_finished_traffic(const char *realm, const char *user, unsigned lon } void prom_inc_allocation(SOCKET_TYPE type) { - if (turn_params.prometheus == 1) { + if (turn_params.prometheus) { const char *label[] = {socket_type_name(type)}; prom_gauge_inc(turn_total_allocations, label); } } void prom_dec_allocation(SOCKET_TYPE type) { - if (turn_params.prometheus == 1) { + if (turn_params.prometheus) { const char *label[] = {socket_type_name(type)}; prom_gauge_dec(turn_total_allocations, label); } } void prom_inc_stun_binding_request(void) { - if (turn_params.prometheus == 1) { + if (turn_params.prometheus) { prom_counter_add(stun_binding_request, 1, NULL); } } void prom_inc_stun_binding_response(void) { - if (turn_params.prometheus == 1) { + if (turn_params.prometheus) { prom_counter_add(stun_binding_response, 1, NULL); } } void prom_inc_stun_binding_error(void) { - if (turn_params.prometheus == 1) { + if (turn_params.prometheus) { prom_counter_add(stun_binding_error, 1, NULL); } }