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

Comparing AnyEvent-MP/MP/Node.pm (file contents):
Revision 1.23 by root, Sat Aug 15 02:36:03 2009 UTC vs.
Revision 1.25 by root, Sat Aug 15 15:08:07 2009 UTC

130 130
131 my $endpoint = shift @endpoints; 131 my $endpoint = shift @endpoints;
132 132
133 $trial{$endpoint} ||= do { 133 $trial{$endpoint} ||= do {
134 my ($host, $port) = AnyEvent::Socket::parse_hostport $endpoint 134 my ($host, $port) = AnyEvent::Socket::parse_hostport $endpoint
135 or return $AnyEvent::MP::Kernel::WARN->("$self->{noderef}: not a resolved node reference."); 135 or return $AnyEvent::MP::Kernel::WARN->(1, "$self->{noderef}: not a resolved node reference.");
136 136
137 AnyEvent::MP::Transport::mp_connect 137 AnyEvent::MP::Transport::mp_connect
138 $host, $port, 138 $host, $port,
139 sub { delete $trial{$endpoint} } 139 sub { delete $trial{$endpoint} }
140 ; 140 ;
154 my ($self, $portid, $cb) = @_; 154 my ($self, $portid, $cb) = @_;
155 155
156 my $list = $self->{lmon}{$portid} ||= []; 156 my $list = $self->{lmon}{$portid} ||= [];
157 157
158 $self->send (["", mon1 => $portid]) 158 $self->send (["", mon1 => $portid])
159 unless @$list; 159 unless @$list || !length $portid;
160 160
161 push @$list, $cb; 161 push @$list, $cb;
162} 162}
163 163
164sub unmonitor { 164sub unmonitor {
206 206
207 # slave nodes are so cool - we can always send to them :) 207 # slave nodes are so cool - we can always send to them :)
208 208
209 $self->{send} = sub { 209 $self->{send} = sub {
210 $self->connect; 210 $self->connect;
211 snd $master, relay => $noderef, @_; 211 snd $master, snd => $noderef, @_;
212 }; 212 };
213 } 213 }
214} 214}
215 215
216sub connect { 216sub connect {
246 delete $AnyEvent::MP::Kernel::PORT{$port}; 246 delete $AnyEvent::MP::Kernel::PORT{$port};
247 delete $AnyEvent::MP::Kernel::PORT_DATA{$port}; 247 delete $AnyEvent::MP::Kernel::PORT_DATA{$port};
248 248
249 my $mon = delete $AnyEvent::MP::Kernel::LMON{$port} 249 my $mon = delete $AnyEvent::MP::Kernel::LMON{$port}
250 or !@reason 250 or !@reason
251 or $AnyEvent::MP::Kernel::WARN->("unmonitored local port $port died with reason: @reason"); 251 or $AnyEvent::MP::Kernel::WARN->(2, "unmonitored local port $port died with reason: @reason");
252 252
253 $_->(@reason) for values %$mon; 253 $_->(@reason) for values %$mon;
254} 254}
255 255
256sub monitor { 256sub monitor {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines