[Sumover-dev] [svn commit] r4554 - common/trunk/src

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Fri Jan 8 12:35:39 GMT 2010


Author: piers
Date: Fri Jan  8 12:35:39 2010
New Revision: 4554

Modified:
   common/trunk/src/net_udp.c
   common/trunk/src/rtp.c

Log:
Added additional error checking when hostname resolution fails - apps (e.g. RAT) now fail on initialisation with an appropriate error message - if they fail to lookup any hostname (including the current hostname - which seems to an issue on OSX at times)


Modified: common/trunk/src/net_udp.c
==============================================================================
--- common/trunk/src/net_udp.c	(original)
+++ common/trunk/src/net_udp.c	Fri Jan  8 12:35:39 2010
@@ -303,6 +303,7 @@
 	if (INET_PTON(AF_INET, addr, &s->addr4) != 1) {
 		struct hostent *h = gethostbyname(addr);
 		if (h == NULL) {
+			debug_msg("Failed to lookup address (%s) for udp initialisation\n", addr);
 			socket_error("Can't resolve IP address for %s", addr);
                         free(s);
 			return NULL;
@@ -459,6 +460,7 @@
 	}
 	hent = gethostbyname(hname);
 	if (hent == NULL) {
+		debug_msg("Failed to lookup current hostname: %s\n", addr);
 		socket_error("Can't resolve IP address for %s", hname);
 		return NULL;
 	}

Modified: common/trunk/src/rtp.c
==============================================================================
--- common/trunk/src/rtp.c	(original)
+++ common/trunk/src/rtp.c	Fri Jan  8 12:35:39 2010
@@ -1052,8 +1052,10 @@
 	session->rx_port	= rx_port;
 	session->tx_port	= tx_port;
 	session->ttl		= min(ttl, 255);
-	session->rtp_socket	= udp_init_if(addr, iface, rx_port, tx_port, ttl);
-	session->rtcp_socket	= udp_init_if(addr, iface, (uint16_t) (rx_port+1), (uint16_t) (tx_port+1), ttl);
+	if (!session->rtp_socket= udp_init_if(addr, iface, rx_port, tx_port, ttl))
+	  return NULL;
+	if(!session->rtcp_socket= udp_init_if(addr, iface, (uint16_t) (rx_port+1), (uint16_t) (tx_port+1), ttl))
+	  return NULL;
 
 	init_opt(session);
 



More information about the Sumover-dev mailing list