brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [01/22] incubator-brooklyn git commit: Bind the socket after setting SO_REUSEADDR to true, behaviour is undefined the other way around
Date Mon, 09 Feb 2015 15:36:20 GMT
Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master e59aac03b -> 4fc5a07ff


Bind the socket after setting SO_REUSEADDR to true, behaviour is undefined the other way around


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/0b5a77d4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/0b5a77d4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/0b5a77d4

Branch: refs/heads/master
Commit: 0b5a77d4f3f8b4e5c1975d67c9cfddbab8a629eb
Parents: fe42507
Author: Matt Champion <mattunderscorechampion@gmail.com>
Authored: Tue Jan 27 17:20:51 2015 +0000
Committer: Matt Champion <mattunderscorechampion@gmail.com>
Committed: Tue Jan 27 17:20:51 2015 +0000

----------------------------------------------------------------------
 .../src/main/java/brooklyn/util/net/Networking.java      | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/0b5a77d4/utils/common/src/main/java/brooklyn/util/net/Networking.java
----------------------------------------------------------------------
diff --git a/utils/common/src/main/java/brooklyn/util/net/Networking.java b/utils/common/src/main/java/brooklyn/util/net/Networking.java
index 2067283..7132bef 100644
--- a/utils/common/src/main/java/brooklyn/util/net/Networking.java
+++ b/utils/common/src/main/java/brooklyn/util/net/Networking.java
@@ -104,14 +104,17 @@ public class Networking {
             ServerSocket ss = null;
             DatagramSocket ds = null;
             try {
+                // Check TCP port
                 ss = new ServerSocket();
                 ss.setSoTimeout(250);
-                ss.bind(new InetSocketAddress(localAddress, port));
                 ss.setReuseAddress(true);
-                
-                ds = new DatagramSocket(port);
+                ss.bind(new InetSocketAddress(localAddress, port));
+
+                // Check UDP port
+                ds = new DatagramSocket();
+                ds.setSoTimeout(250);
                 ds.setReuseAddress(true);
-                
+                ds.bind(new InetSocketAddress(localAddress, port));
             } catch (IOException e) {
                 return false;
             } finally {


Mime
View raw message