diff options
author | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2014-03-24 10:35:14 +0200 |
---|---|---|
committer | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2014-03-24 10:35:14 +0200 |
commit | 1cc5494e9adf6fb25acfa69cfa1e586866549b9a (patch) | |
tree | e035169543d0f28d4c4ad0abab27556372adc09e | |
parent | f5cb93e794fa5e5f78baa29f9b185d703b14f9e5 (diff) | |
download | jitsi-1cc5494e9adf6fb25acfa69cfa1e586866549b9a.zip jitsi-1cc5494e9adf6fb25acfa69cfa1e586866549b9a.tar.gz jitsi-1cc5494e9adf6fb25acfa69cfa1e586866549b9a.tar.bz2 |
Fixes a failure to take into account the user's preference with respect to utilized port ranges in XMPP calls. Reported by Mitchell Langs.
-rw-r--r-- | src/net/java/sip/communicator/service/protocol/media/TransportManager.java | 15 | ||||
-rw-r--r-- | src/net/java/sip/communicator/util/PortTracker.java | 37 |
2 files changed, 25 insertions, 27 deletions
diff --git a/src/net/java/sip/communicator/service/protocol/media/TransportManager.java b/src/net/java/sip/communicator/service/protocol/media/TransportManager.java index 3be2a98..419a001 100644 --- a/src/net/java/sip/communicator/service/protocol/media/TransportManager.java +++ b/src/net/java/sip/communicator/service/protocol/media/TransportManager.java @@ -237,9 +237,6 @@ public abstract class TransportManager<U extends MediaAwareCallPeer<?, ?, ?>> InetAddress intendedDestination = getIntendedDestination(getCallPeer());
InetAddress localHostForPeer = nam.getLocalHost(intendedDestination);
- //make sure our port numbers reflect the configuration service settings
- initializePortNumbers();
-
PortTracker portTracker = getPortTracker(mediaType);
//create the RTP socket.
@@ -589,15 +586,19 @@ public abstract class TransportManager<U extends MediaAwareCallPeer<?, ?, ?>> */
protected static PortTracker getPortTracker(MediaType mediaType)
{
- if (MediaType.AUDIO == mediaType)
+ //make sure our port numbers reflect the configuration service settings
+ initializePortNumbers();
+
+ switch (mediaType)
{
+ case AUDIO:
if (audioPortTracker != null)
return audioPortTracker;
- }
- else if (MediaType.VIDEO == mediaType)
- {
+ break;
+ case VIDEO:
if (videoPortTracker != null)
return videoPortTracker;
+ break;
}
return defaultPortTracker;
diff --git a/src/net/java/sip/communicator/util/PortTracker.java b/src/net/java/sip/communicator/util/PortTracker.java index 9b6fda5..1adf134 100644 --- a/src/net/java/sip/communicator/util/PortTracker.java +++ b/src/net/java/sip/communicator/util/PortTracker.java @@ -77,13 +77,13 @@ public class PortTracker throws IllegalArgumentException { //validate - if( !NetworkUtils.isValidPortNumber(newMinPort) - || !NetworkUtils.isValidPortNumber(newMaxPort) - || newMaxPort < newMinPort) + if((newMaxPort < newMinPort) + || !NetworkUtils.isValidPortNumber(newMinPort) + || !NetworkUtils.isValidPortNumber(newMaxPort)) { throw new IllegalArgumentException( - "[" + newMinPort + " to " - + newMaxPort + "] is not a valid port range."); + "[" + newMinPort + ", " + newMaxPort + + "] is not a valid port range."); } //reset bounds @@ -95,9 +95,7 @@ public class PortTracker * if already valid. */ if (port < minPort || port > maxPort) - { port = minPort; - } } /** @@ -106,25 +104,24 @@ public class PortTracker * this method will simply return without an exception and without an impact * on the state of this class. * - * @param newMinPortString the minimum port that we would like to bind on - * @param newMaxPortString the maximum port that we would like to bind on + * @param newMinPort the minimum port that we would like to bind on + * @param newMaxPort the maximum port that we would like to bind on */ - public void tryRange(String newMinPortString, String newMaxPortString) + public void tryRange(String newMinPort, String newMaxPort) { try { - int newMinPort = Integer.parseInt(newMinPortString); - int newMaxPort = Integer.parseInt(newMaxPortString); - - setRange(newMinPort, newMaxPort); + setRange( + Integer.parseInt(newMinPort), + Integer.parseInt(newMaxPort)); } - catch(Exception exc)//Null, NumberFormat, IllegalArgument + catch(Exception e)//Null, NumberFormat, IllegalArgument { - logger.info("Ignoring invalid port range ["+ newMinPortString - + " to " + newMaxPortString +"]"); - - - logger.debug("Cause: ", exc); + logger.info( + "Ignoring invalid port range [" + newMinPort + ", " + + newMaxPort + "]"); + if (logger.isDebugEnabled()) + logger.debug("Cause: ", e); } } |