| 1 | package Object::Remote::Node; | ||||||||||
| 2 | |||||||||||
| 3 | use strictures 1; | ||||||||||
| 4 | use Object::Remote::Connector::STDIO; | ||||||||||
| 5 | use Object::Remote::Logging qw(:log :dlog); | ||||||||||
| 6 | use Object::Remote::WatchDog; | ||||||||||
| 7 | use Object::Remote; | ||||||||||
| 8 | |||||||||||
| 9 | sub run { | ||||||||||
| 10 | 0 | ▶ | my ($class, %args) = @_; | ||||||||
|
Subroutine
run: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 11 | 0 | ▶ | log_trace { "run() has been invoked on remote node" }; | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 12 | |||||||||||
| 13 | 0 | my $c = Object::Remote::Connector::STDIO->new->connect; | |||||||||
| 14 | |||||||||||
| 15 | 0 | $c->register_class_call_handler; | |||||||||
| 16 | |||||||||||
| 17 | 0 | my $loop = Object::Remote->current_loop; | |||||||||
| 18 | |||||||||||
| 19 | $c->on_close->on_ready(sub { | ||||||||||
| 20 | 0 | ▶ | log_debug { "Node connection with call handler has closed" }; | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 21 | 0 | $loop->want_stop | |||||||||
| 22 | 0 | }); | |||||||||
| 23 | |||||||||||
| 24 | 0 | ▶ | Dlog_trace { "Node is sending 'Shere' to $_" } $c->send_to_fh; | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 25 | 0 | print { $c->send_to_fh } "Shere\n"; | |||||||||
| 26 | |||||||||||
| 27 | 0 | ▶ | log_debug { "Node is going to start the run loop" }; | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 28 | #TODO the alarm should be reset after the run loop starts | ||||||||||
| 29 | #at a minimum - the remote side node should probably send | ||||||||||
| 30 | #a command that clears the alarm in all instances - even | ||||||||||
| 31 | #if the Object::Remote::Watchdog is not being used | ||||||||||
| 32 | 0 | ▶ | if ($args{watchdog_timeout}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | 0 | Object::Remote::WatchDog->instance(timeout => $args{watchdog_timeout}); | |||||||||
| 34 | } else { | ||||||||||
| 35 | #reset connection watchdog from the fatnode | ||||||||||
| 36 | 0 | Object::Remote::WatchDog->shutdown; | |||||||||
| 37 | } | ||||||||||
| 38 | 0 | $loop->want_run; | |||||||||
| 39 | 0 | $loop->run_while_wanted; | |||||||||
| 40 | 0 | ▶ | log_debug { "Run loop invocation in node has completed" }; | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | 1; | ||||||||||