From dc931b33bf8fa61c8eb4d7297e42379543274745 Mon Sep 17 00:00:00 2001 From: jestin Date: Thu, 29 Jul 2004 17:33:08 +0000 Subject: bugfixes majeurs, voir le changelog 1.2.6 --- src/IvyWatcher.java | 78 ++++++++++++++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 37 deletions(-) (limited to 'src/IvyWatcher.java') diff --git a/src/IvyWatcher.java b/src/IvyWatcher.java index dafa6f9..3ac5ef9 100755 --- a/src/IvyWatcher.java +++ b/src/IvyWatcher.java @@ -14,6 +14,9 @@ * thing. * * CHANGELOG: + * 1.2.6: + * - IOException now goes silent when we asked the bus to stop() + * - use a new buffer for each Datagram received, to prevent an old bug * 1.2.5: * - getDomain now sends IvyException for malformed broadcast addresses * - uses apache jakarta-regexp instead of gnu-regexp @@ -56,7 +59,6 @@ import java.lang.Thread; import java.net.*; import java.io.*; import java.util.StringTokenizer; -/* import gnu.regexp.*; GNURETOAPACHERE */ import org.apache.regexp.*; import java.util.Vector; import java.util.Enumeration; @@ -71,6 +73,8 @@ class IvyWatcher implements Runnable { private int port; private volatile Thread listenThread; private InetAddress group; + private static int serial=0; + private int myserial=serial++; /** * creates an Ivy watcher @@ -103,55 +107,57 @@ class IvyWatcher implements Runnable { * the behaviour of each thread watching the UDP socket. */ public void run() { - traceDebug("IvyWatcher Thread started"); // THREADDEBUG + traceDebug("Thread started"); // THREADDEBUG Thread thisThread=Thread.currentThread(); traceDebug("beginning of a watcher Thread"); - byte buf[] = new byte[256]; - DatagramPacket packet=new DatagramPacket(buf, 256); InetAddress remotehost=null; try { while( listenThread==thisThread ) { try { + byte buf[] = new byte[256]; + DatagramPacket packet=new DatagramPacket(buf,buf.length); broadcast.receive(packet); if (listenThread!=thisThread) break; // I was summoned to leave during the receive - String msg = new String(packet.getData()) ; - for (int i=0;iivywatcher<-- "+s); + if (debug) System.out.println("-->IvyWatcher["+myserial+","+bus.getSerial()+"]<-- "+s); } } // class IvyWatcher -/* EOF */ -- cgit v1.1