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

Comparing cvsroot/AnyEvent-MP/MP/Kernel.pm (file contents):
Revision 1.25 by root, Fri Aug 28 20:57:42 2009 UTC vs.
Revision 1.26 by root, Fri Aug 28 21:01:02 2009 UTC

358} 358}
359 359
360############################################################################# 360#############################################################################
361# node monitoring and info 361# node monitoring and info
362 362
363sub _uniq_nodes {
364 my %node;
365
366 @node{values %NODE} = values %NODE;
367
368 values %node;
369}
370
371sub _public_nodes {
372 &_uniq_nodes
373}
374
375=item node_is_known $nodeid 363=item node_is_known $nodeid
376 364
377Returns true iff the given node is currently known to the system. 365Returns true iff the given node is currently known to the system.
378 366
379=cut 367=cut
397 ? 1 : 0 385 ? 1 : 0
398} 386}
399 387
400=item known_nodes 388=item known_nodes
401 389
402Returns the node IDs of all public nodes connected to this node, including 390Returns the node IDs of all nodes currently known to this node, including
403itself. 391itself and nodes not currently connected.
404 392
405=cut 393=cut
406 394
407sub known_nodes { 395sub known_nodes {
408 map $_->{id}, _public_nodes 396 map $_->{id}, values %NODE
409} 397}
410 398
411=item up_nodes 399=item up_nodes
412 400
413Return the node IDs of all public nodes that are currently connected 401Return the node IDs of all nodes that are currently connected (excluding
414(excluding the node itself). 402the node itself).
415 403
416=cut 404=cut
417 405
418sub up_nodes { 406sub up_nodes {
419 map $_->{id}, grep $_->{transport}, _public_nodes 407 map $_->{id}, grep $_->{transport}, values %NODE
420} 408}
421 409
422=item $guard = mon_nodes $callback->($nodeid, $is_up, @reason) 410=item $guard = mon_nodes $callback->($nodeid, $is_up, @reason)
423 411
424Registers a callback that is called each time a node goes up (connection 412Registers a callback that is called each time a node goes up (connection

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines