AnyEvent-MP

 view release on metacpan or  search on metacpan

MP.pm  view on Meta::CPAN


A node ID is a string that uniquely identifies the node within a
network. Depending on the configuration used, node IDs can look like a
hostname, a hostname and a port, or a random string. AnyEvent::MP itself
doesn't interpret node IDs in any way except to uniquely identify a node.

=item binds - C<ip:port>

Nodes can only talk to each other by creating some kind of connection to
each other. To do this, nodes should listen on one or more local transport
endpoints - binds.

Currently, only standard C<ip:port> specifications can be used, which
specify TCP ports to listen on. So a bind is basically just a tcp socket
in listening mode that accepts connections from other nodes.

=item seed nodes

When a node starts, it knows nothing about the network it is in - it
needs to connect to at least one other node that is already in the
network. These other nodes are called "seed nodes".

MP/Node.pm  view on Meta::CPAN

   AE::log 9 => "connecting to $self->{id} with [@$addresses]";

   my $monitor  = $AnyEvent::MP::Kernel::CONFIG->{monitor_timeout};
   my $interval = $AnyEvent::MP::Kernel::CONFIG->{connect_interval};

   $interval = ($monitor - $interval) / @$addresses
      if ($monitor - $interval) / @$addresses < $interval;

   $interval = 0.4 if $interval < 0.4;

   my @endpoints = reverse @$addresses;

   $self->{connect_w} = AE::timer 0, $interval * (0.9 + 0.1 * rand), sub {
      my $endpoint = pop @endpoints
         or return;

      AE::log 9 => "connecting to $self->{id} at $endpoint";

      $self->{trial}{$endpoint} ||= do {
         my ($host, $port) = AnyEvent::Socket::parse_hostport $endpoint
            or return AE::log critical => "$self->{id}: '$endpoint' is not a resolved node reference.";

         AnyEvent::MP::Transport::mp_connect
            $host, $port,
            sub { delete $self->{trial}{$endpoint} },
      };
   };
}

sub kill {
   my ($self, $port, @reason) = @_;

   $self->{send} (["", kil1 => $port, @reason]);
}

README  view on Meta::CPAN

    node ID - "[A-Za-z0-9_\-.:]*"
        A node ID is a string that uniquely identifies the node within a
        network. Depending on the configuration used, node IDs can look like
        a hostname, a hostname and a port, or a random string. AnyEvent::MP
        itself doesn't interpret node IDs in any way except to uniquely
        identify a node.

    binds - "ip:port"
        Nodes can only talk to each other by creating some kind of
        connection to each other. To do this, nodes should listen on one or
        more local transport endpoints - binds.

        Currently, only standard "ip:port" specifications can be used, which
        specify TCP ports to listen on. So a bind is basically just a tcp
        socket in listening mode that accepts connections from other nodes.

    seed nodes
        When a node starts, it knows nothing about the network it is in - it
        needs to connect to at least one other node that is already in the
        network. These other nodes are called "seed nodes".

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.552 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )