geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bschucha...@apache.org
Subject incubator-geode git commit: fixed GEODE-824 : Failure from JGroupsMessengerJUnitTest.testMulticastTest
Date Thu, 21 Jan 2016 20:14:00 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/develop af25147e6 -> e2f8cd001


fixed GEODE-824 : Failure from JGroupsMessengerJUnitTest.testMulticastTest

AvailablePort wasn't correctly setting up its multicast socket to communicate
with JGroups on Dan's Ubuntu VM.  SocketCreator was picking a Docker address
from his system and the JGroups port was binding to this but AvailablePort
wasn't doing the same thing, and it wasn't attempting to join the multicast
group at all.


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

Branch: refs/heads/develop
Commit: e2f8cd001faafb7d9ee1eed6013a000873663959
Parents: af25147
Author: Bruce Schuchardt <bschuchardt@pivotal.io>
Authored: Thu Jan 21 12:09:38 2016 -0800
Committer: Bruce Schuchardt <bschuchardt@pivotal.io>
Committed: Thu Jan 21 12:09:38 2016 -0800

----------------------------------------------------------------------
 .../java/com/gemstone/gemfire/internal/AvailablePort.java    | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e2f8cd00/gemfire-core/src/main/java/com/gemstone/gemfire/internal/AvailablePort.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/AvailablePort.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/AvailablePort.java
index 93c6bc2..7bec09b 100644
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/AvailablePort.java
+++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/AvailablePort.java
@@ -107,17 +107,21 @@ public class AvailablePort {
     }
     
     else if (protocol == MULTICAST) {
-      DatagramSocket socket = null;
+      MulticastSocket socket = null;
       try {
         socket = new MulticastSocket();
+        InetAddress localHost = SocketCreator.getLocalHost();
+        socket.setInterface(localHost);
         socket.setSoTimeout(Integer.getInteger("AvailablePort.timeout", 2000).intValue());
         byte[] buffer = new byte[4];
         buffer[0] = (byte)'p';
         buffer[1] = (byte)'i';
         buffer[2] = (byte)'n';
         buffer[3] = (byte)'g';
+        InetAddress mcid = addr==null? DistributionConfig.DEFAULT_MCAST_ADDRESS : addr;
         SocketAddress mcaddr = new InetSocketAddress(
-          addr==null? DistributionConfig.DEFAULT_MCAST_ADDRESS : addr, port);
+          mcid, port);
+        socket.joinGroup(mcid);
         DatagramPacket packet = new DatagramPacket(buffer, 0, buffer.length, mcaddr);
         socket.send(packet);
         try {


Mime
View raw message