commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1307877 - /commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/utils/discovery/UDPDiscoveryReceiver.java
Date Sat, 31 Mar 2012 19:03:01 GMT
Author: tv
Date: Sat Mar 31 19:03:01 2012
New Revision: 1307877

URL: http://svn.apache.org/viewvc?rev=1307877&view=rev
Log:
Apply patch to fix JCS-89

Modified:
    commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/utils/discovery/UDPDiscoveryReceiver.java

Modified: commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/utils/discovery/UDPDiscoveryReceiver.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/utils/discovery/UDPDiscoveryReceiver.java?rev=1307877&r1=1307876&r2=1307877&view=diff
==============================================================================
--- commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/utils/discovery/UDPDiscoveryReceiver.java
(original)
+++ commons/proper/jcs/branches/generics-interface/src/java/org/apache/jcs/utils/discovery/UDPDiscoveryReceiver.java
Sat Mar 31 19:03:01 2012
@@ -166,9 +166,18 @@ public class UDPDiscoveryReceiver
             final ObjectInputStream objectStream = new ObjectInputStream( byteStream );
             obj = objectStream.readObject();
 
-            if ( log.isDebugEnabled() )
+            if ( (obj != null) && (obj instanceof UDPDiscoveryMessage) )
             {
-                log.debug( "Read object from address [" + packet.getSocketAddress() + "],
object=[" + obj + "]" );
+            	// Ensure that the address we're supposed to send to is, indeed, the address
+            	// of the machine on the other end of this connection.  This guards against
+            	// instances where we don't exactly get the right local host address
+            	UDPDiscoveryMessage msg = (UDPDiscoveryMessage) obj;
+            	msg.setHost(packet.getAddress().getHostAddress());
+
+	            if ( log.isDebugEnabled() )
+	            {
+	                log.debug( "Read object from address [" + packet.getSocketAddress() + "],
object=[" + obj + "]" );
+	            }
             }
         }
         catch ( Exception e )



Mime
View raw message