[Freeswitch-svn] [commit] r13556 - freeswitch/trunk/src

FreeSWITCH SVN anthm at freeswitch.org
Tue Jun 2 15:03:33 PDT 2009


Author: anthm
Date: Tue Jun  2 17:03:33 2009
New Revision: 13556

Log:
fix order of ops to enable logging sooner

Modified:
   freeswitch/trunk/src/switch_core.c
   freeswitch/trunk/src/switch_nat.c
   freeswitch/trunk/src/switch_xml.c

Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c	(original)
+++ freeswitch/trunk/src/switch_core.c	Tue Jun  2 17:03:33 2009
@@ -1176,6 +1176,12 @@
 	runtime.flags = flags;
 	runtime.sps_total = 30;
 
+	*err = NULL;
+
+	if (console) {
+		runtime.console = stdout;
+	}
+
 	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_mask_v4", inet_ntoa(*(struct in_addr *)&mask));
@@ -1188,25 +1194,21 @@
 
 	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) {
 		apr_terminate();
 		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_core_state_machine_init(runtime.memory_pool);
 
-	*err = NULL;
+	switch_load_core_config("switch.conf");
 
-	if (console) {
-		runtime.console = stdout;
-	}
+
+	switch_core_state_machine_init(runtime.memory_pool);
 
 	if (switch_test_flag((&runtime), SCF_USE_SQL)) {
 		switch_core_sqldb_start(runtime.memory_pool);

Modified: freeswitch/trunk/src/switch_nat.c
==============================================================================
--- freeswitch/trunk/src/switch_nat.c	(original)
+++ freeswitch/trunk/src/switch_nat.c	Tue Jun  2 17:03:33 2009
@@ -146,9 +146,14 @@
 
 	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();
 
-	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();
 	}
 	
@@ -156,8 +161,9 @@
 		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_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 {
-		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");
 	}
 }
 

Modified: freeswitch/trunk/src/switch_xml.c
==============================================================================
--- freeswitch/trunk/src/switch_xml.c	(original)
+++ freeswitch/trunk/src/switch_xml.c	Tue Jun  2 17:03:33 2009
@@ -1287,8 +1287,8 @@
 		char *bp = expand_vars(buf, ebuf, sizeof(ebuf), &cur, &err);
 		line++;
 		
-		if (err && stderr) {
-			fprintf(stderr, "Error [%s] in file %s line %d\n", err, file, line);
+		if (err) {
+			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 */



More information about the Freeswitch-svn mailing list