… | |
… | |
116 | $self->{queue} = [$msg]; |
116 | $self->{queue} = [$msg]; |
117 | $self->connect; |
117 | $self->connect; |
118 | } |
118 | } |
119 | } |
119 | } |
120 | |
120 | |
|
|
121 | sub kill { |
|
|
122 | my ($self, $port, @reason) = @_; |
|
|
123 | |
|
|
124 | $self->send (["", kil => $port, @reason]); |
|
|
125 | |
|
|
126 | # delete $AnyEvent::MP::Base::PORT{$port}; |
|
|
127 | |
|
|
128 | # my $mon = delete $AnyEvent::MP::Base::LMON{$port} |
|
|
129 | # or return; |
|
|
130 | |
|
|
131 | # $_->(@reason) for values %$mon; |
|
|
132 | } |
|
|
133 | |
121 | sub monitor { |
134 | sub monitor { |
122 | my ($self, $portid, $cb) = @_; |
135 | my ($self, $portid, $cb) = @_; |
123 | |
136 | |
124 | return $cb->() |
137 | return $cb->() |
125 | if $self->{failed}; |
138 | if $self->{failed}; |
… | |
… | |
252 | sub send { |
265 | sub send { |
253 | local $AnyEvent::MP::Base::SRCNODE = $_[0]; |
266 | local $AnyEvent::MP::Base::SRCNODE = $_[0]; |
254 | AnyEvent::MP::Base::_inject (@{ $_[1] }); |
267 | AnyEvent::MP::Base::_inject (@{ $_[1] }); |
255 | } |
268 | } |
256 | |
269 | |
|
|
270 | sub kill { |
|
|
271 | my ($self, $port, @reason) = @_; |
|
|
272 | |
|
|
273 | delete $AnyEvent::MP::Base::PORT{$port}; |
|
|
274 | |
|
|
275 | my $mon = delete $AnyEvent::MP::Base::LMON{$port} |
|
|
276 | or return; |
|
|
277 | |
|
|
278 | $_->(@reason) for values %$mon; |
|
|
279 | } |
|
|
280 | |
257 | sub monitor { |
281 | sub monitor { |
258 | my ($self, $portid, $cb) = @_; |
282 | my ($self, $portid, $cb) = @_; |
259 | |
283 | |
260 | return $cb->() |
284 | return $cb->() |
261 | unless exists $AnyEvent::MP::Base::PORT{$portid}; |
285 | unless exists $AnyEvent::MP::Base::PORT{$portid}; |