You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by jb...@apache.org on 2020/12/11 21:15:10 UTC
[hadoop] branch branch-3.1 updated: HADOOP-13571.
ServerSocketUtil.getPort() should use loopback address,
not 0.0.0.0. Contributed by Eric Badger
This is an automated email from the ASF dual-hosted git repository.
jbrennan pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/branch-3.1 by this push:
new 392f694 HADOOP-13571. ServerSocketUtil.getPort() should use loopback address, not 0.0.0.0. Contributed by Eric Badger
392f694 is described below
commit 392f69471d360292bf89f05a6ca55ae85701e524
Author: Jim Brennan <jb...@apache.org>
AuthorDate: Fri Dec 11 20:16:56 2020 +0000
HADOOP-13571. ServerSocketUtil.getPort() should use loopback address, not 0.0.0.0. Contributed by Eric Badger
(cherry picked from commit 6de1a8eb678496393b625f430084a6c64e24b804)
---
.../src/test/java/org/apache/hadoop/net/ServerSocketUtil.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/net/ServerSocketUtil.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/net/ServerSocketUtil.java
index 80f2ebc..872791d 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/net/ServerSocketUtil.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/net/ServerSocketUtil.java
@@ -22,6 +22,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
+import java.net.InetAddress;
import java.net.ServerSocket;
import java.util.Random;
@@ -49,7 +50,8 @@ public class ServerSocketUtil {
if (tryPort == 0) {
continue;
}
- try (ServerSocket s = new ServerSocket(tryPort)) {
+ try (ServerSocket s = new ServerSocket(tryPort, 50,
+ InetAddress.getLoopbackAddress())) {
LOG.info("Using port " + tryPort);
return tryPort;
} catch (IOException e) {
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org