aboutsummaryrefslogtreecommitdiff
path: root/src/IvyWatcher.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/IvyWatcher.java')
-rwxr-xr-xsrc/IvyWatcher.java63
1 files changed, 3 insertions, 60 deletions
diff --git a/src/IvyWatcher.java b/src/IvyWatcher.java
index f6507bb..1dcaab0 100755
--- a/src/IvyWatcher.java
+++ b/src/IvyWatcher.java
@@ -16,6 +16,7 @@
* CHANGELOG:
* 1.2.16
* - now uses the synchronized wrappers of the Java API for all collections
+ * - move out the Domain related-code to the Domain class
* 1.2.15
* - allows the fine tuning of the IvyClient socket buffersize using
* IVY_BUFFERSIZE property
@@ -102,8 +103,8 @@ class IvyWatcher extends Thread {
private static int serial=0;
private int myserial=serial++;
private String busWatcherId = null;
+ private static Pattern recoucou;
- private static Pattern recoucou, numbersPoint, exp;
/**
* creates an Ivy watcher
@@ -317,72 +318,13 @@ class IvyWatcher extends Thread {
}
}
- /*
- private boolean isInDomain( InetAddress host ){
- return true;
- // TODO check if this function is useful. for now, it always returns true
- // deprecated since we use Multicast. How to check when we are in UDP
- // broadcast ?
- //
- byte rem_addr[] = host.getAddress();
- for ( int i = 0 ; i < domainaddrList.size(); i++ ) {
- byte addr[] = ((InetAddress)domainaddrList.elementAt(i)).getAddress();
- int j ;
- for ( j = 0 ; j < 4 ; j++ )
- if ( (addr[j] != -1) && (addr[j] != rem_addr[j]) ) break;
- if ( j == 4 ) {
- traceDebug( "host " + host + " is in domain\n" );
- return true;
- }
- }
- traceDebug( "host " + host + " Not in domain\n" );
- return false;
- }
- */
-
- static String getDomain(String net) throws IvyException {
- // System.out.println("debug: net=[" + net+ "]");
- int sep_index = net.lastIndexOf( ":" );
- if ( sep_index != -1 ) { net = net.substring(0,sep_index); }
- try {
- Matcher m = numbersPoint.matcher(net);
- if (!m.matches()) {
- // traceDebug("should only have numbers and point ? I won't add anything... " + net);
- return "127.255.255.255";
- // return net;
- }
- net += ".255.255.255";
- Matcher mm= exp.matcher(net);
- if (!mm.matches()) {
- System.out.println("Bad broascat addr " + net);
- throw new IvyException("bad broadcast addr");
- }
- net=mm.group(1);
- } catch ( PatternSyntaxException e ){
- e.printStackTrace();
- throw new RuntimeException();
- }
- //System.out.println("next domain: "+net);
- return net;
- }
-
- static int getPort(String net) { // returns 0 if no port is set
- int sep_index = net.lastIndexOf( ":" );
- int port= ( sep_index == -1 ) ? 0 :Integer.parseInt( net.substring( sep_index +1 ));
- // System.out.println("net: ["+net+"]\nsep_index: "+sep_index+"\nport: "+port);
- //System.out.println("next port: "+port);
- return port;
- }
-
private void traceDebug(String s){
if (debug) System.out.println("-->IvyWatcher["+myserial+","+bus.getSerial()+"]<-- "+s);
}
static {
try {
- numbersPoint = Pattern.compile("([0-9]|\\.)+");
recoucou = Pattern.compile("([0-9]+) ([0-9]+) ([^ ]*) (.*)",Pattern.DOTALL);
- exp = Pattern.compile( "^(\\d+\\.\\d+\\.\\d+\\.\\d+).*");
} catch (PatternSyntaxException res) {
res.printStackTrace();
System.out.println("Regular Expression bug in Ivy source code ... bailing out");
@@ -390,4 +332,5 @@ class IvyWatcher extends Thread {
}
}
+
} // class IvyWatcher