fix order of ops to enable logging sooner

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13556 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2009-06-02 22:03:33 +00:00
parent f2495ec8e0
commit 4577ec8788
3 changed files with 23 additions and 15 deletions

View File

@ -1176,6 +1176,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
runtime.flags = flags; runtime.flags = flags;
runtime.sps_total = 30; runtime.sps_total = 30;
*err = NULL;
if (console) {
runtime.console = stdout;
}
switch_find_local_ip(guess_ip, sizeof(guess_ip), &mask, AF_INET); switch_find_local_ip(guess_ip, sizeof(guess_ip), &mask, AF_INET);
switch_core_set_variable("local_ip_v4", guess_ip); switch_core_set_variable("local_ip_v4", guess_ip);
switch_core_set_variable("local_mask_v4", inet_ntoa(*(struct in_addr *)&mask)); switch_core_set_variable("local_mask_v4", inet_ntoa(*(struct in_addr *)&mask));
@ -1188,26 +1194,22 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
switch_event_init(runtime.memory_pool); switch_event_init(runtime.memory_pool);
if (switch_test_flag((&runtime), SCF_USE_AUTO_NAT)) {
switch_nat_init(runtime.memory_pool);
}
if (switch_xml_init(runtime.memory_pool, err) != SWITCH_STATUS_SUCCESS) { if (switch_xml_init(runtime.memory_pool, err) != SWITCH_STATUS_SUCCESS) {
apr_terminate(); apr_terminate();
return SWITCH_STATUS_MEMERR; return SWITCH_STATUS_MEMERR;
} }
switch_load_core_config("switch.conf"); if (switch_test_flag((&runtime), SCF_USE_AUTO_NAT)) {
switch_nat_init(runtime.memory_pool);
}
switch_log_init(runtime.memory_pool, runtime.colorize_console); switch_log_init(runtime.memory_pool, runtime.colorize_console);
switch_load_core_config("switch.conf");
switch_core_state_machine_init(runtime.memory_pool); switch_core_state_machine_init(runtime.memory_pool);
*err = NULL;
if (console) {
runtime.console = stdout;
}
if (switch_test_flag((&runtime), SCF_USE_SQL)) { if (switch_test_flag((&runtime), SCF_USE_SQL)) {
switch_core_sqldb_start(runtime.memory_pool); switch_core_sqldb_start(runtime.memory_pool);
} }

View File

@ -146,9 +146,14 @@ SWITCH_DECLARE(void) switch_nat_init(switch_memory_pool_t *pool)
switch_find_local_ip(nat_globals.pvt_addr, sizeof(nat_globals.pvt_addr), NULL, AF_INET); switch_find_local_ip(nat_globals.pvt_addr, sizeof(nat_globals.pvt_addr), NULL, AF_INET);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Detecting NAT\n");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking for PMP\n");
init_pmp(); init_pmp();
if (!nat_globals.nat_type) { if (nat_globals.nat_type) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking for UPNP\n");
init_upnp(); init_upnp();
} }
@ -156,8 +161,9 @@ SWITCH_DECLARE(void) switch_nat_init(switch_memory_pool_t *pool)
switch_core_set_variable("nat_public_addr", nat_globals.pub_addr); switch_core_set_variable("nat_public_addr", nat_globals.pub_addr);
switch_core_set_variable("nat_private_addr", nat_globals.pvt_addr); switch_core_set_variable("nat_private_addr", nat_globals.pvt_addr);
switch_core_set_variable("nat_type", nat_globals.nat_type == SWITCH_NAT_TYPE_PMP ? "pmp" : "upnp"); switch_core_set_variable("nat_type", nat_globals.nat_type == SWITCH_NAT_TYPE_PMP ? "pmp" : "upnp");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "NAT detected type: %s\n", nat_globals.nat_type == SWITCH_NAT_TYPE_PMP ? "pmp" : "upnp");
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No PMP or uPNP NAT device detected!\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No PMP or uPNP NAT device detected!\n");
} }
} }

View File

@ -1287,8 +1287,8 @@ static int preprocess(const char *cwd, const char *file, int write_fd, int rleve
char *bp = expand_vars(buf, ebuf, sizeof(ebuf), &cur, &err); char *bp = expand_vars(buf, ebuf, sizeof(ebuf), &cur, &err);
line++; line++;
if (err && stderr) { if (err) {
fprintf(stderr, "Error [%s] in file %s line %d\n", err, file, line); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error [%s] in file %s line %d\n", err, file, line);
} }
/* we ignore <include> or </include> for the sake of validators as well as <?xml version="1.0"?> type stuff */ /* we ignore <include> or </include> for the sake of validators as well as <?xml version="1.0"?> type stuff */