ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-MP/bin/aemp
(Generate patch)

Comparing AnyEvent-MP/bin/aemp (file contents):
Revision 1.6 by root, Thu Aug 13 00:23:36 2009 UTC vs.
Revision 1.7 by root, Thu Aug 13 00:49:23 2009 UTC

9 aemp command args... 9 aemp command args...
10 10
11 # protocol commands 11 # protocol commands
12 aemp snd <port> <arg...> # send a message 12 aemp snd <port> <arg...> # send a message
13 aemp mon <port> # wait till port is killed 13 aemp mon <port> # wait till port is killed
14 aemp rpc <port> <arg...> # send message, append reply
14 15
15 # node configuration: secret 16 # node configuration: secret
16 aemp gensecret # generate a random shared secret 17 aemp gensecret # generate a random shared secret
17 aemp setsecret <secret> # set the shared secret 18 aemp setsecret <secret> # set the shared secret
18 aemp clrsecret # remove the secret 19 aemp clrsecret # remove the secret
80our %CMD = ( 81our %CMD = (
81 snd => sub { 82 snd => sub {
82 my $port = resolve_port shift @ARGV; 83 my $port = resolve_port shift @ARGV;
83 initialise_node "slave/", node_of $port; 84 initialise_node "slave/", node_of $port;
84 85
85 snd $port, @ARGV; 86 snd $port, @ARGV; @ARGV = ();
86 87
87 my $cv = AE::cv; 88 my $cv = AE::cv;
89 my $to = AE::timer 5, 0, sub { $cv->("timeout") };
88 mon $port, $cv; 90 mon $port, $cv;
89 my $reply = port { &$cv }; 91 my $reply = port { &$cv; 1 };
90 snd node_of $port, relay => $reply, "ok"; 92 snd node_of $port, relay => $reply, "ok";
93
94 print join " ", $cv->recv, "\n";
95 },
96
97 rpc => sub {
98 my $port = resolve_port shift @ARGV;
99 initialise_node "slave/", node_of $port;
100
101 my $cv = AE::cv;
102 my $to = AE::timer 5, 0, sub { $cv->("timeout") };
103 my $reply = port { &$cv; 1 };
104 snd $port, @ARGV, $reply; @ARGV = ();
105 mon $port, $cv;
91 106
92 print join " ", $cv->recv, "\n"; 107 print join " ", $cv->recv, "\n";
93 }, 108 },
94 109
95 mon => sub { 110 mon => sub {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines