Merge pull request !69 from xlongwei/v4-dev
This commit is contained in:
Looly 2019-09-04 09:21:18 +08:00 committed by Gitee
commit 8529787c7b

View File

@ -160,8 +160,9 @@ public class NetUtil {
*/
public static int getUsableLocalPort(int minPort, int maxPort) {
for (int i = minPort; i <= maxPort; i++) {
if (isUsableLocalPort(RandomUtil.randomInt(minPort, maxPort + 1))) {
return i;
int randomPort = RandomUtil.randomInt(minPort, maxPort + 1);
if (isUsableLocalPort(randomPort)) {
return randomPort;
}
}