ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-MP/MP/Kernel.pm
(Generate patch)

Comparing AnyEvent-MP/MP/Kernel.pm (file contents):
Revision 1.48 by root, Tue Sep 8 13:46:25 2009 UTC vs.
Revision 1.49 by root, Wed Sep 9 01:47:01 2009 UTC

205sub snd(@) { 205sub snd(@) {
206 my ($nodeid, $portid) = split /#/, shift, 2; 206 my ($nodeid, $portid) = split /#/, shift, 2;
207 207
208 warn "SND $nodeid <- " . eval { JSON::XS->new->encode (\@_) } . "\n" if TRACE && @_;#d# 208 warn "SND $nodeid <- " . eval { JSON::XS->new->encode (\@_) } . "\n" if TRACE && @_;#d#
209 209
210 defined $nodeid #d#UGLY
211 or Carp::croak "'undef' is not a valid node ID/port ID";
212
210 ($NODE{$nodeid} || add_node $nodeid) 213 ($NODE{$nodeid} || add_node $nodeid)
211 ->{send} (["$portid", @_]); 214 ->{send} (["$portid", @_]);
212} 215}
213 216
214=item $is_local = port_is_local $port 217=item $is_local = port_is_local $port
238 # on $NODE, we artificially delay... (for spawn) 241 # on $NODE, we artificially delay... (for spawn)
239 # this is very ugly - maybe we should simply delay ALL messages, 242 # this is very ugly - maybe we should simply delay ALL messages,
240 # to avoid deep recursion issues. but that's so... slow... 243 # to avoid deep recursion issues. but that's so... slow...
241 $AnyEvent::MP::Node::Self::DELAY = 1 244 $AnyEvent::MP::Node::Self::DELAY = 1
242 if $nodeid ne $NODE; 245 if $nodeid ne $NODE;
246
247 defined $nodeid #d#UGLY
248 or Carp::croak "'undef' is not a valid node ID/port ID";
243 249
244 ($NODE{$nodeid} || add_node $nodeid)->send (["", @_]); 250 ($NODE{$nodeid} || add_node $nodeid)->send (["", @_]);
245} 251}
246 252
247=item snd_on $node, @msg 253=item snd_on $node, @msg
469Returns the node IDs of all nodes currently known to this node, including 475Returns the node IDs of all nodes currently known to this node, including
470itself and nodes not currently connected. 476itself and nodes not currently connected.
471 477
472=cut 478=cut
473 479
474sub known_nodes { 480sub known_nodes() {
475 map $_->{id}, values %NODE 481 map $_->{id}, values %NODE
476} 482}
477 483
478=item up_nodes 484=item up_nodes
479 485
480Return the node IDs of all nodes that are currently connected (excluding 486Return the node IDs of all nodes that are currently connected (excluding
481the node itself). 487the node itself).
482 488
483=cut 489=cut
484 490
485sub up_nodes { 491sub up_nodes() {
486 map $_->{id}, grep $_->{transport}, values %NODE 492 map $_->{id}, grep $_->{transport}, values %NODE
487} 493}
488 494
489=item $guard = mon_nodes $callback->($nodeid, $is_up, @reason) 495=item $guard = mon_nodes $callback->($nodeid, $is_up, @reason)
490 496

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines