summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormertz2002-04-25 13:40:22 +0000
committermertz2002-04-25 13:40:22 +0000
commit1fa71abf046b0b21013702ee817ea5cc8649b05f (patch)
tree28208e76d2c69f4356ad59d2390a7b95ffdef600
parente67764478b7b4abea36e924fcac813bf1779b6e2 (diff)
downloadivy-perl-1fa71abf046b0b21013702ee817ea5cc8649b05f.zip
ivy-perl-1fa71abf046b0b21013702ee817ea5cc8649b05f.tar.gz
ivy-perl-1fa71abf046b0b21013702ee817ea5cc8649b05f.tar.bz2
ivy-perl-1fa71abf046b0b21013702ee817ea5cc8649b05f.tar.xz
*** empty log message ***
-rwxr-xr-xexample/ivyprobe.pl52
1 files changed, 40 insertions, 12 deletions
diff --git a/example/ivyprobe.pl b/example/ivyprobe.pl
index 7595cb4..2cc1d51 100755
--- a/example/ivyprobe.pl
+++ b/example/ivyprobe.pl
@@ -78,19 +78,28 @@ Ivy->mainLoop;
# this function has 3 additionnal parameters till Ivy Version 4.6
# and now getting the new/dying applications is straightforward.
-# The first 3 parameters are kept only for compatibility!
+# The first 3 parameters are kept only for upward compatibility!
sub statusFunc {
- my ($ref_ready, $ref_nonReady, $ref_hashReady, $appname, $status, $host) = @_;
+ my ($ref_ready, $ref_nonReady, $ref_hashReady, $appname, $status, $host_or_regexp) = @_;
if ($status eq "new") {
- print "$appname connected from $host\n";
- $where_applications{"$appname:$host"}++;
+ print "$appname connected from $host_or_regexp\n";
+ $where_applications{"$appname:$host_or_regexp"}++;
}
elsif ($status eq "died") {
- print "$appname disconnected from $host\n";
- $where_applications{"$appname:$host"}--;
+ print "$appname disconnected from $host_or_regexp\n";
+ $where_applications{"$appname:$host_or_regexp"}--;
}
-
+ elsif ($status eq 'subscribing') {
+ print "$appname subscribed to '$host_or_regexp'\n";
+ }
+ elsif ($status eq 'unsubscribing') {
+ print "$appname unsubscribed to '$host_or_regexp'\n";
+ }
+ else {
+ print "Bug: unkown status; $status in &statusFunc\n";
+ }
+
%connected_applications = %$ref_hashReady;
}
@@ -135,6 +144,14 @@ sub interpret_line {
return 0;
}
+ if ($str =~ /^.u(nbind)?\s+(.*)$/) {
+ my $regexp = $2;
+ if ($regexp =~ /'(.*)'/) { $regexp = $1; }
+ print "unbinding $regexp\n";
+ $Ivyobj->bindRegexp($regexp);
+ return 0;
+ }
+
if ($str =~ /^.db(ind)?\s+(.*)$/) {
my $id = $2;
print "direct binding id $id\n";
@@ -151,6 +168,15 @@ sub interpret_line {
return 0;
}
+ if ($str =~ /^.p(ing)?\s+(\S+)\s+(\d+)\s*$/) {
+ my $appname = $2;
+ my $timeout = $3;
+ print "ping $appname timeout=$timeout\n";
+ my $res = $Ivyobj->ping($appname, $timeout);
+ print "$res\n";
+ return 0;
+ }
+
if ($str =~ /^.who\s*$/) {
print "Apps:";
foreach my $app (sort keys %connected_applications) {
@@ -178,7 +204,7 @@ sub interpret_line {
return 0;
}
- print "bad command: .help for list of commands\n";
+ print "bad command. Type '.help' for a list of commands\n";
return 0;
}
@@ -232,9 +258,11 @@ sub line_command_usage {
print " .h[elp] - this help\n";
print " .q[uit] - terminate this application\n";
print " .b[ind] regexp - add a msg to receive\n";
+ print " .u[nbind] regexp - remove a msg to receive\n";
print " .die appname - send die msg to appname\n";
print " .db[ind] id - add a direct msg to receive\n";
print " .d[irect] appname id args - send direct msg to appname\n";
+ print " .p[ing] appname timeout - ping appname with a delay of timeout ms NYI\n";
print " .where appname - on which host is/are appname\n";
print " .who - who is on the bus\n";
}
@@ -287,6 +315,10 @@ to add a direct msg of type id to receive
to send a direct msg to appname. The message type is indicated by id
+=item B<.u[nbind] regexp>
+
+To unsubscribe to messages matching the regexp
+
=item B<.where appname>
To get the host on which appname is/are running
@@ -295,10 +327,6 @@ To get the host on which appname is/are running
to get the list of all connected applications
-=item B<.h[elp]>
-
-to get the list of available commands and short explanations
-
=back
=head1 BUGS