r3251 - trunk/libmnetutil/source

erik at minisip.org erik at minisip.org
Tue Mar 27 16:09:00 CEST 2007


Author: erik
Date: 2007-03-27 16:08:59 +0200 (Tue, 27 Mar 2007)
New Revision: 3251

Modified:
   trunk/libmnetutil/source/UDPSocket.cxx
Log:

 * bug(?) fix in UDP socket: We set SO_REUSEADDR before doing "bind". This
   meant that we don't care if the port is already busy. I don't think this
   is what we want as default behavour. We'd should rather throw an
   exception and let the application handle it.



Modified: trunk/libmnetutil/source/UDPSocket.cxx
===================================================================
--- trunk/libmnetutil/source/UDPSocket.cxx	2007-03-22 16:48:52 UTC (rev 3250)
+++ trunk/libmnetutil/source/UDPSocket.cxx	2007-03-27 14:08:59 UTC (rev 3251)
@@ -76,12 +76,17 @@
 		throw SocketFailed( errno );
 		#endif
 	}
-	int32_t on=1;
-#ifndef WIN32
-	setsockopt(fd,SOL_SOCKET,SO_REUSEADDR, (void *) (&on),sizeof(on));
-#else
-	setsockopt(fd,SOL_SOCKET,SO_REUSEADDR, (const char *) (&on),sizeof(on));
-#endif
+
+// I believe the following code should be removed, or enabled using a
+// parameter. I think we should fail if the port is busy by default. 
+//	int32_t on=1;
+//#ifndef WIN32
+//	setsockopt(fd,SOL_SOCKET,SO_REUSEADDR, (void *) (&on),sizeof(on));
+//#else
+//	setsockopt(fd,SOL_SOCKET,SO_REUSEADDR, (const char *) (&on),sizeof(on));
+//#endif
+
+
 #ifdef HAVE_IPV6
 	if (use_ipv6){
 		struct sockaddr_in6 addr;



More information about the Minisip-devel mailing list