… | |
… | |
294 | length $portid |
294 | length $portid |
295 | or Carp::croak "$nodeid#$portid: killing a node port is not allowed, caught"; |
295 | or Carp::croak "$nodeid#$portid: killing a node port is not allowed, caught"; |
296 | |
296 | |
297 | ($NODE{$nodeid} || add_node $nodeid) |
297 | ($NODE{$nodeid} || add_node $nodeid) |
298 | ->kill ("$portid", @_); |
298 | ->kill ("$portid", @_); |
|
|
299 | } |
|
|
300 | |
|
|
301 | # actual code that kills a port |
|
|
302 | sub _kill { |
|
|
303 | my $port = shift; |
|
|
304 | |
|
|
305 | delete $PORT{$port} |
|
|
306 | or return; # killing nonexistent ports is O.K. |
|
|
307 | delete $PORT_DATA{$port}; |
|
|
308 | |
|
|
309 | my $mon = delete $LMON{$port} |
|
|
310 | or !@_ |
|
|
311 | or $WARN->(2, "unmonitored local port $port died with reason: @_"); |
|
|
312 | |
|
|
313 | $_->(@_) for values %$mon; |
299 | } |
314 | } |
300 | |
315 | |
301 | sub _nodename { |
316 | sub _nodename { |
302 | require POSIX; |
317 | require POSIX; |
303 | (POSIX::uname ())[1] |
318 | (POSIX::uname ())[1] |
… | |
… | |
587 | }, |
602 | }, |
588 | |
603 | |
589 | # "public" services - not actually public |
604 | # "public" services - not actually public |
590 | |
605 | |
591 | # another node wants to kill a local port |
606 | # another node wants to kill a local port |
592 | kil => sub { |
607 | kil => \&_kill, |
593 | $NODE{""}->kill (@_); |
|
|
594 | }, |
|
|
595 | |
608 | |
596 | # relay message to another node / generic echo |
609 | # relay message to another node / generic echo |
597 | snd => \&snd, |
610 | snd => \&snd, |
598 | snd_multiple => sub { |
611 | snd_multiple => sub { |
599 | snd @$_ for @_ |
612 | snd @$_ for @_ |