aboutsummaryrefslogtreecommitdiff
path: root/src/IvyWatcher.java
diff options
context:
space:
mode:
authorjestin2005-07-06 20:03:49 +0000
committerjestin2005-07-06 20:03:49 +0000
commit0cef96242b0e0aa10b4b33ee0f4b175048dbe3e0 (patch)
tree06afd0e92815bcdfa856a67c765862b551e39e4d /src/IvyWatcher.java
parentfe015aed1f9aa5f2d7247f9262d7f12c59536379 (diff)
downloadivy-java-0cef96242b0e0aa10b4b33ee0f4b175048dbe3e0.zip
ivy-java-0cef96242b0e0aa10b4b33ee0f4b175048dbe3e0.tar.gz
ivy-java-0cef96242b0e0aa10b4b33ee0f4b175048dbe3e0.tar.bz2
ivy-java-0cef96242b0e0aa10b4b33ee0f4b175048dbe3e0.tar.xz
Voir les fichiers eux-même pour les nouveautés. Préparation de 1.2.8
Diffstat (limited to 'src/IvyWatcher.java')
-rwxr-xr-xsrc/IvyWatcher.java22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/IvyWatcher.java b/src/IvyWatcher.java
index 5009c03..93d5a8f 100755
--- a/src/IvyWatcher.java
+++ b/src/IvyWatcher.java
@@ -14,6 +14,9 @@
* thing.
*
* CHANGELOG:
+ * 1.2.8:
+ * - alreadyBroadcasted was static, thus Ivy Agents within the same JVM used
+ * to share the list of agents already connected. A nasty bug.
* 1.2.7:
* - better handling of multiple connexions from the same remote agent when
* there are different broadcast addresses ( introduced the alreadyBroadcasted
@@ -76,7 +79,7 @@ class IvyWatcher implements Runnable {
private InetAddress localhost,loopback;
private String domainaddr;
private int port;
- private volatile Thread listenThread;
+ private volatile Thread listenThread = null;
private InetAddress group;
private static int serial=0;
private int myserial=serial++;
@@ -146,17 +149,11 @@ class IvyWatcher implements Runnable {
if (bus.applicationPort==remotePort) {
traceDebug("ignoring a broadcast from "+ remotehostname+":"+packet.getPort()
+" on my port number ("+remotePort+"), it's probably me");
- // TODO check better
- // if bus.applicationPort=remotePort
- // parse the list of Watchers and check for each
- // iw.broadcast.getInetAddress().equals(packet().getAddress()
- // if one is true, "continue" ( ignore the broadcast )
+ // TODO check this in a better way
continue;
}
traceDebug("broadcast accepted from " +remotehostname
+":"+packet.getPort()+", port:"+remotePort+", protocol version:"+version);
- // 1.2.7 ? TODO two connexions from the same host on different broadcast
- // addresses (e.g. sam simu)
if (!alreadyBroadcasted(remotehost.toString(),remotePort)) {
traceDebug("no known agent originating from " + remotehost + ":" + remotePort);
new IvyClient(bus,new Socket(remotehost,remotePort),remotePort);
@@ -202,7 +199,8 @@ class IvyWatcher implements Runnable {
}
private class PacketSender implements Runnable {
- // TODO do I need multiple packetsenders ?
+ // do I need multiple packetsenders ? Well, there is one PacketSender per
+ // domain.
DatagramPacket packet;
String data;
public PacketSender(String data) {
@@ -239,11 +237,12 @@ class IvyWatcher implements Runnable {
/*
* since 1.2.7 pre ....
+ * went local instead of static ! fixed a nasty bug in 1.2.8
* checks if there is already a broadcast received from the same address
* on the same port
*/
- static private Hashtable alreadySocks=new Hashtable();
- static private synchronized boolean alreadyBroadcasted(String s,int port) {
+ private Hashtable alreadySocks=new Hashtable();
+ private synchronized boolean alreadyBroadcasted(String s,int port) {
// System.out.println("DEBUUUUUUUG " + s+ ":" + port);
if (s==null) return false;
Integer i = (Integer)alreadySocks.get(s);
@@ -307,7 +306,6 @@ class IvyWatcher implements Runnable {
return port;
}
-
private void traceDebug(String s){
if (debug) System.out.println("-->IvyWatcher["+myserial+","+bus.getSerial()+"]<-- "+s);
}