r3417 - trunk/libminisip/source/subsystem_signaling/sip

erik at minisip.org erik at minisip.org
Tue Sep 4 23:32:37 CEST 2007


Author: erik
Date: 2007-09-04 23:32:37 +0200 (Tue, 04 Sep 2007)
New Revision: 3417

Modified:
   trunk/libminisip/source/subsystem_signaling/sip/Sip.cxx
Log:

 * IPv6 bind problem: For me, binding to the IPv6 version of the UDP socket
   fails. My initial guess is that we already accept connections on the
   IPv6 address when we bind to "ANY" address in the IPv4 case.

   When this happens, we break out of the section that sets up the 
   sockets, and therefore don't try to set up TCP or TLS.

   This fix does not solve the actual problem with binding to the socket.
   With this "fix" we have a try statement for each of the transport types.



Modified: trunk/libminisip/source/subsystem_signaling/sip/Sip.cxx
===================================================================
--- trunk/libminisip/source/subsystem_signaling/sip/Sip.cxx	2007-09-04 21:23:43 UTC (rev 3416)
+++ trunk/libminisip/source/subsystem_signaling/sip/Sip.cxx	2007-09-04 21:32:37 UTC (rev 3417)
@@ -304,14 +304,23 @@
 #ifdef DEBUG_OUTPUT
 		mout << BOLD << "init 8.1/9: Starting UDP transport worker thread" << PLAIN << endl;
 #endif
-		sipstack->startUdpServer();
+		try{
+			sipstack->startUdpServer();
+		}catch(NetworkException &e){
+			//FIXME: This happens when binding to the IPv6 address
+			merr << "Error: Failed to create to UDP socket: "<< e.what()<<endl;
+		}
 
 		if (phoneconfig->tcp_server){
 #ifdef DEBUG_OUTPUT
 			mout << BOLD << "init 8.2/9: Starting TCP transport worker thread" << PLAIN << endl;
 #endif
 
-			sipstack->startTcpServer();
+			try{
+				sipstack->startTcpServer();
+			}catch(NetworkException &e){
+				merr << "Error: Failed to create TCP socket"<<endl;
+			}
 
 		}
 
@@ -324,13 +333,18 @@
 #ifdef DEBUG_OUTPUT
 				mout << BOLD << "init 8.3/9: Starting TLS transport worker thread" << PLAIN << endl;
 #endif
-				sipstack->startTlsServer();
+				try{
+					sipstack->startTlsServer();
+				}catch(NetworkException &e){
+					merr << "Error: Failed to create TLS socket"<<endl;
+				}
+
 			}
 		}
 	}
-	catch( NetworkException & exc ){
-		cerr << "ERROR: Exception thrown when creating"
-			"TCP/TLS servers." << endl;
+	catch( Exception & exc ){
+		cerr << "ERROR: Exception thrown when creating "
+			"UDP/TCP/TLS servers." << endl;
 		cerr << exc.what() << endl;
 	}
 



More information about the Minisip-devel mailing list