--- AnyEvent-MP/MP.pm 2009/08/14 16:15:37 1.54 +++ AnyEvent-MP/MP.pm 2009/08/15 04:34:34 1.57 @@ -199,12 +199,20 @@ will try to connect to all of them and will become a slave attached to the first node it can successfully connect to. +Note that slave nodes cannot change their name, and consequently, their +master, so if the master goes down, the slave node will not function well +anymore until it can re-establish conenciton to its master. This makes +slave nodes unsuitable for long-term nodes or fault-tolerant networks. + =back This function will block until all nodes have been resolved and, for slave nodes, until it has successfully established a connection to a master server. +All the seednodes will also be specially marked to automatically retry +connecting to them infinitely. + Example: become a public node listening on the guessed noderef, or the one specified via C for the current node. This should be the most common form of invocation for "daemon"-type nodes. @@ -668,60 +676,13 @@ $_[0] =~ /::/ or Carp::croak "spawn init function must be a fully-qualified name, caught"; - ($NODE{$noderef} || add_node $noderef) - ->send (["", "AnyEvent::MP::_spawn" => $id, @_]); + snd_to_func $noderef, "AnyEvent::MP::_spawn" => $id, @_; "$noderef#$id" } =back -=head1 NODE MESSAGES - -Nodes understand the following messages sent to them. Many of them take -arguments called C<@reply>, which will simply be used to compose a reply -message - C<$reply[0]> is the port to reply to, C<$reply[1]> the type and -the remaining arguments are simply the message data. - -While other messages exist, they are not public and subject to change. - -=over 4 - -=cut - -=item lookup => $name, @reply - -Replies with the port ID of the specified well-known port, or C. - -=item devnull => ... - -Generic data sink/CPU heat conversion. - -=item relay => $port, @msg - -Simply forwards the message to the given port. - -=item eval => $string[ @reply] - -Evaluates the given string. If C<@reply> is given, then a message of the -form C<@reply, $@, @evalres> is sent. - -Example: crash another node. - - snd $othernode, eval => "exit"; - -=item time => @reply - -Replies the the current node time to C<@reply>. - -Example: tell the current node to send the current time to C<$myport> in a -C message. - - snd $NODE, time => $myport, timereply => 1, 2; - # => snd $myport, timereply => 1, 2,