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

FreeSWITCH SVN brian at freeswitch.org
Fri May 29 18:03:56 PDT 2009


Author: brian
Date: Fri May 29 20:03:55 2009
New Revision: 13517

Log:
 more tweaks 

Modified:
   freeswitch/trunk/src/switch_nat.c

Modified: freeswitch/trunk/src/switch_nat.c
==============================================================================
--- freeswitch/trunk/src/switch_nat.c	(original)
+++ freeswitch/trunk/src/switch_nat.c	Fri May 29 20:03:55 2009
@@ -181,13 +181,15 @@
 		select(FD_SETSIZE, &fds, NULL, NULL, &timeout);
 		r = readnatpmpresponseorretry(&nat_globals.natpmp, &response);
 	} while(r == NATPMP_TRYAGAIN);
-	
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mapped public port %hu protocol %s to localport %hu\n",
-					  response.pnu.newportmapping.mappedpublicport,
-					  response.type == NATPMP_RESPTYPE_UDPPORTMAPPING ? "UDP" :
-					  (response.type == NATPMP_RESPTYPE_TCPPORTMAPPING ? "TCP" : "UNKNOWN"),
-					  response.pnu.newportmapping.privateport);
-	status = SWITCH_STATUS_SUCCESS;
+
+	if (r == 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mapped public port %hu protocol %s to localport %hu\n",
+						  response.pnu.newportmapping.mappedpublicport,
+						  response.type == NATPMP_RESPTYPE_UDPPORTMAPPING ? "UDP" :
+						  (response.type == NATPMP_RESPTYPE_TCPPORTMAPPING ? "TCP" : "UNKNOWN"),
+						  response.pnu.newportmapping.privateport);
+		status = SWITCH_STATUS_SUCCESS;
+	}
 
 	return status;
 }
@@ -211,6 +213,7 @@
 						  (proto == SWITCH_NAT_TCP) ? "TCP" : (proto == SWITCH_NAT_UDP ? "UDP" : "UNKNOWN"), port_str);
 						  status = SWITCH_STATUS_SUCCESS;
 	}
+
 	return status;
 }
 
@@ -235,13 +238,15 @@
 		select(FD_SETSIZE, &fds, NULL, NULL, &timeout);
 		r = readnatpmpresponseorretry(&nat_globals.natpmp, &response);
 	} while(r == NATPMP_TRYAGAIN);
-		
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unmapped public port %hu protocol %s to localport %hu\n",
-					  response.pnu.newportmapping.mappedpublicport,
-					  response.type == NATPMP_RESPTYPE_UDPPORTMAPPING ? "UDP" :
-					  (response.type == NATPMP_RESPTYPE_TCPPORTMAPPING ? "TCP" : "UNKNOWN"),
-					  response.pnu.newportmapping.privateport);
-	status = SWITCH_STATUS_SUCCESS;
+
+	if (r == 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unmapped public port %hu protocol %s to localport %hu\n",
+						  response.pnu.newportmapping.mappedpublicport,
+						  response.type == NATPMP_RESPTYPE_UDPPORTMAPPING ? "UDP" :
+						  (response.type == NATPMP_RESPTYPE_TCPPORTMAPPING ? "TCP" : "UNKNOWN"),
+						  response.pnu.newportmapping.privateport);
+		status = SWITCH_STATUS_SUCCESS;
+	}
 
 	return status;
 }



More information about the Freeswitch-svn mailing list