From 48476725195a7590cac015ab359beea5e2750f43 Mon Sep 17 00:00:00 2001 From: Boris Grozev Date: Wed, 29 Mar 2017 14:21:10 -0500 Subject: [PATCH] ref: Removes an unused an buggy method. port*2 can be outside the [min, max] range (if min > 0). --- src/main/java/org/ice4j/ice/NetworkUtils.java | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/src/main/java/org/ice4j/ice/NetworkUtils.java b/src/main/java/org/ice4j/ice/NetworkUtils.java index 6838b31..48d71a6 100644 --- a/src/main/java/org/ice4j/ice/NetworkUtils.java +++ b/src/main/java/org/ice4j/ice/NetworkUtils.java @@ -150,34 +150,6 @@ public class NetworkUtils return portNumberGenerator.nextInt(max - min + 1) + min; } - /** - * Returns a random local port number, greater than min and lower than max. - * If the pair flag is set to true, then the returned port number is - * guaranteed to be pair. This is useful for protocols that require this - * such as RTP - * - * @param min the minimum allowed value for the returned port number. - * @param max the maximum allowed value for the returned port number. - * @param pair specifies whether the caller would like the returned port to - * be pair. - * - * @return a random int located between greater than min and lower than max. - */ - public static int getRandomPortNumber(int min, int max, boolean pair) - { - if(pair) - { - int delta = max - min; - delta /= 2; - int port = getRandomPortNumber(min, min + delta); - return port * 2; - } - else - { - return getRandomPortNumber(min, max); - } - } - /** * Verifies whether address could be an IPv4 address string. *