Cleanup logs on turnserver start (#1088)
Reformatting and removing some duplications: - Some lines have WARNING WARNING: cleaned up. - Lines printed using perror: only LOG_ mechanism should be used. - Printing IO mechanism (epoll for example) for each thread: selected mechanism logged once - Duplicate lines (perror and also LOG): duplication removed - Duplicates: clean up (because calling function multiple times - configuration load)
This commit is contained in:
parent
e55bbc0413
commit
95373d3e2a
@ -1120,8 +1120,6 @@ char *find_config_file(const char *config_file, int print_file_name) {
|
||||
FILE *f = fopen(fn, "r");
|
||||
if (f) {
|
||||
fclose(f);
|
||||
if (print_file_name)
|
||||
print_abs_file_name("", "Config", fn);
|
||||
full_path_to_config_file = fn;
|
||||
break;
|
||||
}
|
||||
@ -1148,8 +1146,6 @@ char *find_config_file(const char *config_file, int print_file_name) {
|
||||
f = fopen(fn, "r");
|
||||
if (f) {
|
||||
fclose(f);
|
||||
if (print_file_name)
|
||||
print_abs_file_name("", "Config", fn);
|
||||
full_path_to_config_file = fn;
|
||||
break;
|
||||
}
|
||||
@ -1241,23 +1237,38 @@ unsigned long get_system_number_of_cpus(void) {
|
||||
#if defined(WINDOWS)
|
||||
SYSTEM_INFO sysInfo;
|
||||
GetSystemInfo(&sysInfo);
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_DEBUG, "System cpu num is %d\n", sysInfo.dwNumberOfProcessors);
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_DEBUG, "System enable num is 0x%X\n", sysInfo.dwActiveProcessorMask);
|
||||
// TURN_LOG_FUNC(TURN_LOG_LEVEL_DEBUG, "System cpu num is %d\n", sysInfo.dwNumberOfProcessors);
|
||||
return sysInfo.dwNumberOfProcessors;
|
||||
#else
|
||||
#if defined(_SC_NPROCESSORS_ONLN)
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_DEBUG, "System cpu num is %ld \n", sysconf(_SC_NPROCESSORS_CONF));
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_DEBUG, "System enable num is %ld\n", sysconf(_SC_NPROCESSORS_ONLN));
|
||||
// TURN_LOG_FUNC(TURN_LOG_LEVEL_DEBUG, "System cpu num is %ld \n", sysconf(_SC_NPROCESSORS_CONF));
|
||||
return sysconf(_SC_NPROCESSORS_CONF);
|
||||
#else
|
||||
// GNU way
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_DEBUG, "System cpu num is %d\n", get_nprocs_conf());
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_DEBUG, "System enable num is %d\n", get_nprocs());
|
||||
// TURN_LOG_FUNC(TURN_LOG_LEVEL_DEBUG, "System cpu num is %d\n", get_nprocs_conf());
|
||||
return get_nprocs_conf();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
unsigned long get_system_active_number_of_cpus(void) {
|
||||
#if defined(WINDOWS)
|
||||
SYSTEM_INFO sysInfo;
|
||||
GetSystemInfo(&sysInfo);
|
||||
// TURN_LOG_FUNC(TURN_LOG_LEVEL_DEBUG, "System enable num is 0x%X\n", sysInfo.dwActiveProcessorMask);
|
||||
return sysInfo.dwActiveProcessorMask;
|
||||
#else
|
||||
#if defined(_SC_NPROCESSORS_ONLN)
|
||||
// TURN_LOG_FUNC(TURN_LOG_LEVEL_DEBUG, "System enable num is %ld\n", sysconf(_SC_NPROCESSORS_ONLN));
|
||||
return sysconf(_SC_NPROCESSORS_ONLN);
|
||||
#else
|
||||
// GNU way
|
||||
// TURN_LOG_FUNC(TURN_LOG_LEVEL_DEBUG, "System enable num is %d\n", get_nprocs());
|
||||
return get_nprocs();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////// Base 64 ////////////////////////////
|
||||
|
||||
static char encoding_table[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
|
||||
|
||||
@ -213,6 +213,7 @@ int get_raw_socket_ttl(evutil_socket_t fd, int family);
|
||||
void ignore_sigpipe(void);
|
||||
unsigned long set_system_parameters(int max_resources);
|
||||
unsigned long get_system_number_of_cpus(void);
|
||||
unsigned long get_system_active_number_of_cpus(void);
|
||||
|
||||
///////////////////////// MTU //////////////////////////
|
||||
|
||||
|
||||
@ -77,8 +77,9 @@ struct option /* specification for a long form option... */
|
||||
int val; /* its associated status value */
|
||||
};
|
||||
|
||||
enum /* permitted values for its `has_arg' field... */
|
||||
{ no_argument = 0, /* option never takes an argument */
|
||||
enum /* permitted values for its `has_arg' field... */
|
||||
{
|
||||
no_argument = 0, /* option never takes an argument */
|
||||
required_argument, /* option always requires an argument */
|
||||
optional_argument /* option may take an argument */
|
||||
};
|
||||
|
||||
@ -2424,10 +2424,10 @@ static void read_config_file(int argc, char **argv, int pass) {
|
||||
|
||||
fclose(f);
|
||||
|
||||
} else
|
||||
} else if (pass == 0) {
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_WARNING,
|
||||
"WARNING: Cannot find config file: %s. Default and command-line settings will be used.\n",
|
||||
config_file);
|
||||
"Cannot find config file: %s. Default and command-line settings will be used.\n", config_file);
|
||||
}
|
||||
|
||||
if (full_path_to_config_file) {
|
||||
free(full_path_to_config_file);
|
||||
@ -2674,9 +2674,8 @@ static int adminmain(int argc, char **argv) {
|
||||
}
|
||||
|
||||
static void print_features(unsigned long mfn) {
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "\nRFC 3489/5389/5766/5780/6062/6156 STUN/TURN Server\nVersion %s\n",
|
||||
TURN_SOFTWARE);
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "\nMax number of open files/sockets allowed for this process: %lu\n", mfn);
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "Coturn Version %s\n", TURN_SOFTWARE);
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "Max number of open files/sockets allowed for this process: %lu\n", mfn);
|
||||
if (turn_params.net_engine_version == NEV_UDP_SOCKET_PER_ENDPOINT)
|
||||
mfn = mfn / 3;
|
||||
else
|
||||
@ -2685,7 +2684,7 @@ static void print_features(unsigned long mfn) {
|
||||
if (mfn < 500)
|
||||
mfn = 500;
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO,
|
||||
"\nDue to the open files/sockets limitation,\nmax supported number of TURN Sessions possible is: %lu "
|
||||
"Due to the open files/sockets limitation, max supported number of TURN Sessions possible is: %lu "
|
||||
"(approximately)\n",
|
||||
mfn);
|
||||
|
||||
@ -2702,21 +2701,27 @@ static void print_features(unsigned long mfn) {
|
||||
brightness and honed to a murderous sharpness.
|
||||
*/
|
||||
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "OpenSSL compile-time version: %s (0x%lx)\n", OPENSSL_VERSION_TEXT,
|
||||
OPENSSL_VERSION_NUMBER);
|
||||
|
||||
#if !TLS_SUPPORTED
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "TLS is not supported\n");
|
||||
#else
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "TLS supported\n");
|
||||
#elif TLSv1_3_SUPPORTED
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "TLS 1.3 supported\n");
|
||||
#elif TLSv1_2_SUPPORTED
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "TLS 1.2 supported\n");
|
||||
#elif TLSv1_1_SUPPORTED
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "TLS 1.1 supported\n");
|
||||
#elif TLSv1_SUPPORTED
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "TLS 1.0 supported\n");
|
||||
#endif
|
||||
|
||||
#if !DTLS_SUPPORTED
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "DTLS is not supported\n");
|
||||
#else
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "DTLS supported\n");
|
||||
#if DTLSv1_2_SUPPORTED
|
||||
#elif DTLSv1_2_SUPPORTED
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "DTLS 1.2 supported\n");
|
||||
#else
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "DTLS 1.2 is not supported\n");
|
||||
#endif
|
||||
#elif DTLS_SUPPORTED
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "DTLS supported\n");
|
||||
#endif
|
||||
|
||||
#if ALPN_SUPPORTED
|
||||
@ -2736,11 +2741,6 @@ static void print_features(unsigned long mfn) {
|
||||
#endif
|
||||
}
|
||||
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "OpenSSL compile-time version: %s (0x%lx)\n", OPENSSL_VERSION_TEXT,
|
||||
OPENSSL_VERSION_NUMBER);
|
||||
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "\n");
|
||||
|
||||
#if !defined(TURN_NO_SQLITE)
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "SQLite supported, default database location is %s\n", DEFAULT_USERDB_FILE);
|
||||
#else
|
||||
@ -2771,11 +2771,7 @@ static void print_features(unsigned long mfn) {
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "MongoDB is not supported\n");
|
||||
#endif
|
||||
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "\n");
|
||||
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO,
|
||||
"Default Net Engine version: %d (%s)\n\n=====================================================\n\n",
|
||||
(int)turn_params.net_engine_version,
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "Default Net Engine version: %d (%s)\n", (int)turn_params.net_engine_version,
|
||||
turn_params.net_engine_version_txt[(int)turn_params.net_engine_version]);
|
||||
}
|
||||
|
||||
@ -2922,13 +2918,15 @@ int main(int argc, char **argv) {
|
||||
int cpus = get_system_number_of_cpus();
|
||||
if (0 < cpus)
|
||||
turn_params.cpus = get_system_number_of_cpus();
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "System cpu num is %lu\n", turn_params.cpus);
|
||||
if (turn_params.cpus < DEFAULT_CPUS_NUMBER)
|
||||
turn_params.cpus = DEFAULT_CPUS_NUMBER;
|
||||
else if (turn_params.cpus > MAX_NUMBER_OF_GENERAL_RELAY_SERVERS)
|
||||
turn_params.cpus = MAX_NUMBER_OF_GENERAL_RELAY_SERVERS;
|
||||
|
||||
turn_params.general_relay_servers_number = (turnserver_id)turn_params.cpus;
|
||||
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "System cpu num is %lu\n", turn_params.cpus);
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "System enable num is %lu\n", get_system_active_number_of_cpus());
|
||||
}
|
||||
|
||||
memset(&turn_params.default_users_db, 0, sizeof(default_users_db_t));
|
||||
@ -2993,15 +2991,15 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
if (turn_params.no_udp_relay) {
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "\nCONFIG: --no-udp-relay: UDP relay endpoints are not allowed.\n");
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "CONFIG: --no-udp-relay: UDP relay endpoints are not allowed.\n");
|
||||
}
|
||||
|
||||
if (turn_params.no_tcp_relay) {
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "\nCONFIG: --no-tcp-relay: TCP relay endpoints are not allowed.\n");
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "CONFIG: --no-tcp-relay: TCP relay endpoints are not allowed.\n");
|
||||
}
|
||||
|
||||
if (turn_params.server_relay) {
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_WARNING, "\nCONFIG: WARNING: --server-relay: NON-STANDARD AND DANGEROUS OPTION.\n");
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_WARNING, "CONFIG: WARNING: --server-relay: NON-STANDARD AND DANGEROUS OPTION.\n");
|
||||
}
|
||||
|
||||
#if !defined(TURN_NO_SQLITE)
|
||||
@ -3014,34 +3012,33 @@ int main(int argc, char **argv) {
|
||||
argv += optind;
|
||||
|
||||
if (argc > 0) {
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "\nCONFIGURATION ALERT: Unknown argument: %s\n", argv[argc - 1]);
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "CONFIG: Unknown argument: %s\n", argv[argc - 1]);
|
||||
}
|
||||
|
||||
if (use_lt_credentials && anon_credentials) {
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "\nCONFIG ERROR: -a and -z options cannot be used together.\n");
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "CONFIG: -a and -z options cannot be used together.\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (use_ltc && use_tltc) {
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_WARNING,
|
||||
"\nCONFIGURATION ALERT: You specified --lt-cred-mech and --use-auth-secret in the same time.\n"
|
||||
"CONFIG: You specified --lt-cred-mech and --use-auth-secret in the same time.\n"
|
||||
"Be aware that you could not mix the username/password and the shared secret based auth methods. \n"
|
||||
"Shared secret overrides username/password based auth method. Check your configuration!\n");
|
||||
}
|
||||
|
||||
if (turn_params.allow_loopback_peers) {
|
||||
TURN_LOG_FUNC(
|
||||
TURN_LOG_LEVEL_WARNING,
|
||||
"CONFIG WARNING: allow_loopback_peers opens a possible security vulnerability. Do not use in production!!\n");
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_WARNING,
|
||||
"CONFIG: allow_loopback_peers opens a possible security vulnerability. Do not use in production!!\n");
|
||||
if (cli_password[0] == 0 && use_cli) {
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR,
|
||||
"\nCONFIG ERROR: allow_loopback_peers and empty cli password cannot be used together.\n");
|
||||
"CONFIG: allow_loopback_peers and empty cli password cannot be used together.\n");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
if (use_cli && cli_password[0] == 0) {
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "\nCONFIG ERROR: Empty cli-password, and so telnet cli interface is disabled! "
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "CONFIG: Empty cli-password, and so telnet cli interface is disabled! "
|
||||
"Please set a non empty cli-password!\n");
|
||||
use_cli = 0;
|
||||
}
|
||||
@ -3049,7 +3046,7 @@ int main(int argc, char **argv) {
|
||||
if (!use_lt_credentials && !anon_credentials) {
|
||||
if (turn_params.default_users_db.ram_db.users_number) {
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_WARNING,
|
||||
"\nCONFIGURATION ALERT: you specified long-term user accounts, (-u option) \n but you did "
|
||||
"CONFIG: you specified long-term user accounts, (-u option) \n but you did "
|
||||
"not specify the long-term credentials option\n (-a or --lt-cred-mech option).\n I am "
|
||||
"turning --lt-cred-mech ON for you, but double-check your configuration.\n");
|
||||
turn_params.ct = TURN_CREDENTIALS_LONG_TERM;
|
||||
@ -3063,7 +3060,7 @@ int main(int argc, char **argv) {
|
||||
if (use_lt_credentials) {
|
||||
if (!get_realm(NULL)->options.name[0]) {
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_WARNING,
|
||||
"\nCONFIGURATION ALERT: you did specify the long-term credentials usage\n but you did not specify "
|
||||
"CONFIG: you did specify the long-term credentials usage\n but you did not specify "
|
||||
"the default realm option (-r option).\n Check your configuration.\n");
|
||||
}
|
||||
}
|
||||
@ -3071,8 +3068,8 @@ int main(int argc, char **argv) {
|
||||
if (anon_credentials) {
|
||||
if (turn_params.default_users_db.ram_db.users_number) {
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_WARNING,
|
||||
"\nCONFIGURATION ALERT: you specified user accounts, (-u option) \n but you also specified the "
|
||||
"anonymous user access option (-z or --no-auth option).\n User accounts will be ignored.\n");
|
||||
"CONFIG: you specified user accounts, (-u option) but you also specified the "
|
||||
"anonymous user access option (-z or --no-auth option). User accounts will be ignored.\n");
|
||||
turn_params.ct = TURN_CREDENTIALS_NONE;
|
||||
use_lt_credentials = 0;
|
||||
}
|
||||
@ -3157,12 +3154,12 @@ int main(int argc, char **argv) {
|
||||
if (pid > 0)
|
||||
exit(0);
|
||||
if (pid < 0) {
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "ERROR: Cannot start daemon process\n");
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Cannot start daemon process\n");
|
||||
exit(-1);
|
||||
}
|
||||
#else
|
||||
if (daemon(1, 0) < 0) {
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "ERROR: Cannot start daemon process\n");
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Cannot start daemon process\n");
|
||||
exit(-1);
|
||||
}
|
||||
reset_rtpprintf();
|
||||
@ -3176,9 +3173,7 @@ int main(int argc, char **argv) {
|
||||
if (f) {
|
||||
STRCPY(s, turn_params.pidfile);
|
||||
} else {
|
||||
snprintf(s, sizeof(s), "Cannot create pid file: %s", turn_params.pidfile);
|
||||
perror(s);
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_WARNING, "%s\n", s);
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_WARNING, "Cannot create pid file: %s\n", turn_params.pidfile);
|
||||
|
||||
{
|
||||
const char *pfs[] = {"/var/run/turnserver.pid",
|
||||
@ -3302,7 +3297,7 @@ static void adjust_key_file_name(char *fn, const char *file_title, int critical)
|
||||
{
|
||||
FILE *f = full_path_to_file ? fopen(full_path_to_file, "r") : NULL;
|
||||
if (!f) {
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_WARNING, "WARNING: cannot find %s file: %s (1)\n", file_title, fn);
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_WARNING, "cannot find %s file: %s (1)\n", file_title, fn);
|
||||
goto keyerr;
|
||||
} else {
|
||||
fclose(f);
|
||||
@ -3310,7 +3305,7 @@ static void adjust_key_file_name(char *fn, const char *file_title, int critical)
|
||||
}
|
||||
|
||||
if (!full_path_to_file) {
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_WARNING, "WARNING: cannot find %s file: %s (2)\n", file_title, fn);
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_WARNING, "cannot find %s file: %s (2)\n", file_title, fn);
|
||||
goto keyerr;
|
||||
}
|
||||
|
||||
@ -3325,8 +3320,8 @@ keyerr : {
|
||||
if (critical) {
|
||||
turn_params.no_tls = 1;
|
||||
turn_params.no_dtls = 1;
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_WARNING,
|
||||
"WARNING: cannot start TLS and DTLS listeners because %s file is not set properly\n", file_title);
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_WARNING, "cannot start TLS and DTLS listeners because %s file is not set properly\n",
|
||||
file_title);
|
||||
}
|
||||
if (full_path_to_file)
|
||||
free(full_path_to_file);
|
||||
@ -3531,8 +3526,6 @@ static void set_ctx(SSL_CTX **out, const char *protocol, const SSL_METHOD *metho
|
||||
if (!SSL_CTX_use_certificate_chain_file(ctx, turn_params.cert_file)) {
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "%s: ERROR: no certificate found\n", protocol);
|
||||
err = 1;
|
||||
} else {
|
||||
print_abs_file_name(protocol, ": Certificate", turn_params.cert_file);
|
||||
}
|
||||
|
||||
if (!SSL_CTX_use_PrivateKey_file(ctx, turn_params.pkey_file, SSL_FILETYPE_PEM)) {
|
||||
@ -3540,13 +3533,8 @@ static void set_ctx(SSL_CTX **out, const char *protocol, const SSL_METHOD *metho
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR,
|
||||
"%s: ERROR: no valid private key found, or invalid private key password provided\n", protocol);
|
||||
err = 1;
|
||||
} else {
|
||||
print_abs_file_name(protocol, ": Private RSA key", turn_params.pkey_file);
|
||||
}
|
||||
} else {
|
||||
print_abs_file_name(protocol, ": Private key", turn_params.pkey_file);
|
||||
}
|
||||
|
||||
if (!SSL_CTX_check_private_key(ctx)) {
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "%s: ERROR: invalid private key\n", protocol);
|
||||
err = 1;
|
||||
@ -3758,6 +3746,10 @@ static void openssl_setup(void) {
|
||||
}
|
||||
|
||||
static void openssl_load_certificates(void) {
|
||||
|
||||
print_abs_file_name("", "Certificate", turn_params.cert_file);
|
||||
print_abs_file_name("", "Private key", turn_params.pkey_file);
|
||||
|
||||
TURN_MUTEX_LOCK(&turn_params.tls_mutex);
|
||||
if (!turn_params.no_tls) {
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
|
||||
@ -927,7 +927,6 @@ static void listener_receive_message(struct bufferevent *bev, void *ptr) {
|
||||
|
||||
static ioa_engine_handle create_new_listener_engine(void) {
|
||||
struct event_base *eb = turn_event_base_new();
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "IO method (udp listener/relay thread): %s\n", event_base_get_method(eb));
|
||||
super_memory_t *sm = new_super_memory_region();
|
||||
ioa_engine_handle e =
|
||||
create_ioa_engine(sm, eb, turn_params.listener.tp, turn_params.relay_ifname, turn_params.relays_number,
|
||||
@ -965,8 +964,7 @@ static void setup_listener(void) {
|
||||
|
||||
turn_params.listener.event_base = turn_event_base_new();
|
||||
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "IO method (main listener thread): %s\n",
|
||||
event_base_get_method(turn_params.listener.event_base));
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "IO method: %s\n", event_base_get_method(turn_params.listener.event_base));
|
||||
|
||||
turn_params.listener.ioa_eng = create_ioa_engine(
|
||||
sm, turn_params.listener.event_base, turn_params.listener.tp, turn_params.relay_ifname, turn_params.relays_number,
|
||||
@ -997,14 +995,12 @@ static void setup_listener(void) {
|
||||
if (turn_params.rfc5780 == 1) {
|
||||
if (turn_params.listener.addrs_number < 2 || turn_params.external_ip) {
|
||||
turn_params.rfc5780 = 0;
|
||||
TURN_LOG_FUNC(
|
||||
TURN_LOG_LEVEL_WARNING,
|
||||
"WARNING: I cannot support STUN CHANGE_REQUEST functionality because only one IP address is provided\n");
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_WARNING, "STUN CHANGE_REQUEST not supported: only one IP address is provided\n");
|
||||
} else {
|
||||
turn_params.listener.services_number = turn_params.listener.services_number * 2;
|
||||
}
|
||||
} else {
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "INFO: RFC5780 disabled! /NAT behavior discovery/\n");
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "RFC5780 disabled! /NAT behavior discovery/\n");
|
||||
}
|
||||
|
||||
turn_params.listener.udp_services = (dtls_listener_relay_server_type ***)allocate_super_memory_engine(
|
||||
@ -1602,7 +1598,6 @@ static void setup_relay_server(struct relay_server *rs, ioa_engine_handle e, int
|
||||
rs->ioa_eng = e;
|
||||
} else {
|
||||
rs->event_base = turn_event_base_new();
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "IO method (general relay thread): %s\n", event_base_get_method(rs->event_base));
|
||||
rs->ioa_eng = create_ioa_engine(rs->sm, rs->event_base, turn_params.listener.tp, turn_params.relay_ifname,
|
||||
turn_params.relays_number, turn_params.relay_addrs, turn_params.default_relays,
|
||||
turn_params.verbose
|
||||
@ -1735,7 +1730,6 @@ static void *run_auth_server_thread(void *arg) {
|
||||
as->id = id;
|
||||
|
||||
as->event_base = turn_event_base_new();
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "IO method (auth thread): %s\n", event_base_get_method(as->event_base));
|
||||
|
||||
struct bufferevent *pair[2];
|
||||
|
||||
@ -1827,6 +1821,7 @@ void setup_server(void) {
|
||||
allocate_relay_addrs_ports();
|
||||
setup_barriers();
|
||||
setup_general_relay_servers();
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "Total General servers: %d\n", (int)get_real_general_relay_servers_number());
|
||||
|
||||
if (turn_params.net_engine_version == NEV_UDP_SOCKET_PER_THREAD)
|
||||
setup_socket_per_thread_udp_listener_servers();
|
||||
@ -1852,7 +1847,6 @@ void setup_server(void) {
|
||||
{
|
||||
int tot = get_real_general_relay_servers_number();
|
||||
if (tot) {
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "Total General servers: %d\n", (int)tot);
|
||||
int i;
|
||||
for (i = 0; i < tot; i++) {
|
||||
if (!(general_relay_servers[i])) {
|
||||
@ -1868,6 +1862,7 @@ void setup_server(void) {
|
||||
authserver[sn].id = sn;
|
||||
setup_auth_server(&(authserver[sn]));
|
||||
}
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "Total auth threads: %d\n", authserver_number);
|
||||
}
|
||||
|
||||
setup_admin_server();
|
||||
|
||||
@ -397,7 +397,6 @@ ioa_engine_handle create_ioa_engine(super_memory_t *sm, struct event_base *eb, t
|
||||
e->deallocate_eb = 0;
|
||||
} else {
|
||||
e->event_base = turn_event_base_new();
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "IO method (engine own thread): %s\n", event_base_get_method(e->event_base));
|
||||
e->deallocate_eb = 1;
|
||||
}
|
||||
|
||||
|
||||
@ -1293,8 +1293,6 @@ void setup_admin_thread(void) {
|
||||
set_ssl_ctx(adminserver.e, &turn_params);
|
||||
}
|
||||
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "IO method (admin thread): %s\n", event_base_get_method(adminserver.event_base));
|
||||
|
||||
{
|
||||
struct bufferevent *pair[2];
|
||||
|
||||
|
||||
@ -4811,7 +4811,7 @@ void init_turn_server(turn_turnserver *server, turnserver_id id, int verbose, io
|
||||
server->mobile_connections_map = ur_map_create();
|
||||
server->acme_redirect = acme_redirect;
|
||||
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "turn server id=%d created\n", (int)id);
|
||||
TURN_LOG_FUNC(TURN_LOG_LEVEL_DEBUG, "turn server id=%d created\n", (int)id);
|
||||
|
||||
server->check_origin = check_origin;
|
||||
server->no_tcp_relay = no_tcp_relay;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user