[Opalvoip-svn] SF.net SVN: opalvoip:[21334] opal/trunk
Brought to you by:
csoutheren,
rjongbloed
From: <rjo...@us...> - 2008-10-15 00:42:11
|
Revision: 21334 http://opalvoip.svn.sourceforge.net/opalvoip/?rev=21334&view=rev Author: rjongbloed Date: 2008-10-15 00:42:02 +0000 (Wed, 15 Oct 2008) Log Message: ----------- Fixed some Linux weirdness where the first attempt to do TCP listen exclusive prevents the second attempt to listen with REUSEADDR flag set. The reason the code tries one and then the other is lost in the mists of time, so lets just make it do one OR the other and see what gives. Also, fixed being able to specify socket re-use address mode (a trailing '+' in address string) without a port. Now something like "*+" will work, listening on all interfaces in non-exclusive mode. Modified Paths: -------------- opal/trunk/src/opal/transports.cxx Property Changed: ---------------- opal/trunk/ Property changes on: opal/trunk ___________________________________________________________________ Modified: svn:mergeinfo - /opal/branches/autoconf:20594-21001 /opal/branches/rjongbloed/BarnardPlus:20584,20656,20749,20751,20756,20762,20786,20789,20814,20820,20829,20831,20841,20843,20923,20927,20938 /opal/branches/v3_2:21143,21220,21227,21253 /opal/branches/v3_4:21060,21062,21088,21092,21111,21113,21115,21119,21143,21148,21151-21152,21155,21158,21184,21188,21253,21265-21266,21283-21284,21298,21300,21303,21307,21309,21311,21327,21331 /opal/trunk:12524-20593 /ptlib/trunk:20820 + /opal/branches/autoconf:20594-21001 /opal/branches/rjongbloed/BarnardPlus:20584,20656,20749,20751,20756,20762,20786,20789,20814,20820,20829,20831,20841,20843,20923,20927,20938 /opal/branches/v3_2:21143,21220,21227,21253 /opal/branches/v3_4:21060,21062,21088,21092,21111,21113,21115,21119,21143,21148,21151-21152,21155,21158,21184,21188,21253,21265-21266,21283-21284,21298,21300,21303,21307,21309,21311,21327,21331,21333 /opal/trunk:12524-20593 /ptlib/trunk:20820 Modified: opal/trunk/src/opal/transports.cxx =================================================================== --- opal/trunk/src/opal/transports.cxx 2008-10-15 00:39:59 UTC (rev 21333) +++ opal/trunk/src/opal/transports.cxx 2008-10-15 00:42:02 UTC (rev 21334) @@ -209,8 +209,12 @@ if (transport == NULL) return; - if (port != 0 && Find(':', dollar) == P_MAX_INDEX) - sprintf(":%u", port); + if (port != 0 && Find(':', dollar) == P_MAX_INDEX) { + PINDEX end = GetLength(); + if (GetAt(end-1) == '+') + end--; + Splice(psprintf(":%u", port), end); + } } @@ -576,27 +580,12 @@ return StartThread(theAcceptHandler, mode); } - if (listener.Listen(localAddress, 1, listenerPort)) + if (listener.Listen(localAddress, 10, listenerPort, exclusiveListener ? PSocket::AddressIsExclusive : PSocket::CanReuseAddress)) return StartThread(theAcceptHandler, mode); - if (exclusiveListener) { - PTRACE(1, "Listen\tOpen on " << localAddress << ':' << listener.GetPort() - << " failed: " << listener.GetErrorText()); - return PFalse; - } - - if (listener.GetErrorNumber() != EADDRINUSE) - return PFalse; - - PTRACE(1, "Listen\tSocket for " << localAddress << ':' << listener.GetPort() - << " already in use, incoming connections may not all be serviced!"); - - if (listener.Listen(localAddress, 100, 0, PSocket::CanReuseAddress)) - return StartThread(theAcceptHandler, mode); - - PTRACE(1, "Listen\tOpen (REUSEADDR) on " << localAddress << ':' << listener.GetPort() + PTRACE(1, "Listen\tOpen (" << (exclusiveListener ? "EXCLUSIVE" : "REUSEADDR") << ") on " << localAddress << ':' << listener.GetPort() << " failed: " << listener.GetErrorText()); - return PFalse; + return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |