Issue #699 Return codes for prom server

This commit is contained in:
Giacomo Vacca 2021-09-21 17:26:48 +02:00
parent 4c059b0d3b
commit 8aded3556e
2 changed files with 6 additions and 2 deletions

View File

@ -2589,9 +2589,13 @@ int main(int argc, char **argv)
drop_privileges();
#if !defined(TURN_NO_PROMETHEUS)
if (start_prometheus_server()){
int prometheus_status = start_prometheus_server();
if (prometheus_status < 0) {
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Could not start Prometheus collector!\n");
}
else if (prometheus_status == 1) {
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "Prometheus collector disabled, not started.\n");
}
else {
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "Prometheus collector started successfully.\n");
}

View File

@ -62,7 +62,7 @@ int start_prometheus_server(void){
struct MHD_Daemon *daemon = promhttp_start_daemon(MHD_USE_SELECT_INTERNALLY, DEFAULT_PROM_SERVER_PORT, NULL, NULL);
if (daemon == NULL) {
return 1;
return -1;
}
return 0;
}