aboutsummaryrefslogtreecommitdiff
path: root/src/Probe.java
diff options
context:
space:
mode:
authorjestin2001-10-10 15:36:44 +0000
committerjestin2001-10-10 15:36:44 +0000
commitcb920a78a1ee3eeaf6d45c0c29aa74714b2d9319 (patch)
treed5d5f8469189d441124072f5ea06313cfdbeab12 /src/Probe.java
parent5ef7f02fef093aebb79ef1a1f37908664702b1cb (diff)
downloadivy-java-cb920a78a1ee3eeaf6d45c0c29aa74714b2d9319.zip
ivy-java-cb920a78a1ee3eeaf6d45c0c29aa74714b2d9319.tar.gz
ivy-java-cb920a78a1ee3eeaf6d45c0c29aa74714b2d9319.tar.bz2
ivy-java-cb920a78a1ee3eeaf6d45c0c29aa74714b2d9319.tar.xz
Bugfix related to the "a(.*) (.*)' regexp causing the loss of front empty
messages.
Diffstat (limited to 'src/Probe.java')
-rw-r--r--src/Probe.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/Probe.java b/src/Probe.java
index 84e282f..6e4543b 100644
--- a/src/Probe.java
+++ b/src/Probe.java
@@ -12,11 +12,11 @@ import java.io.*;
*/
class Probe implements IvyApplicationListener, IvyMessageListener {
- public static void main(String[] args) {
+ public static void main(String[] args) throws IvyException {
Probe p = new Probe();
Getopt opt = new Getopt("Probe",args,"b:d");
int c;
- String domain=Ivy.DEFAULT_DOMAIN;
+ String domain=Ivy.getDomain(null);
while ((c = opt.getopt()) != -1) switch (c) {
case 'b':
domain=opt.getOptarg();
@@ -37,11 +37,10 @@ class Probe implements IvyApplicationListener, IvyMessageListener {
System.out.println("broadcasting on "+domain);
bus.start(domain);
String s;
- BufferedReader in =
- new BufferedReader(new InputStreamReader(System.in));
+ BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
// infinite loop on keyboard input
try {
- while ((s=in.readLine()).length()!=0)
+ while (p.looping() && (s=in.readLine()).length()!=0)
System.out.println("-> Sent to " +bus.sendMsg(s)+" peers");
} catch (NullPointerException e) {
bus.stop();
@@ -53,6 +52,10 @@ class Probe implements IvyApplicationListener, IvyMessageListener {
}
}
+ private boolean looping=true;
+
+ public boolean looping() { return looping ; } // accessor
+
public void connect(IvyClient client) {
System.out.println(client.getApplicationName() + " connected " );
for (java.util.Enumeration e=client.getRegexps();e.hasMoreElements();)
@@ -65,7 +68,8 @@ class Probe implements IvyApplicationListener, IvyMessageListener {
}
public void die(IvyClient client, int id) {
- System.out.println(client.getApplicationName() + " die "+ id );
+ looping=false;
+ System.out.println(client.getApplicationName() + " received die msg from "+ id );
}
public void directMessage(IvyClient client, int id, String arg) {