X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FObject%2FRemote%2FNode.pm;h=93ca2321565aec5ca4b4d16b89b536b660c997f9;hb=8d757beb3bd870615c5a5b3076f7dc72ae9cc637;hp=58923c8f2581fb51c127df6129339d1f8e490f62;hpb=9d64d2d9b2401f99b747ecf754384adb661f0a5b;p=scpubgit%2FObject-Remote.git diff --git a/lib/Object/Remote/Node.pm b/lib/Object/Remote/Node.pm index 58923c8..93ca232 100644 --- a/lib/Object/Remote/Node.pm +++ b/lib/Object/Remote/Node.pm @@ -2,23 +2,31 @@ package Object::Remote::Node; use strictures 1; use Object::Remote::Connector::STDIO; -use Object::Remote::Logging qw(:log); +use Object::Remote::Logging qw(:log :dlog); +use Object::Remote::WatchDog; use Object::Remote; use CPS::Future; sub run { - log_trace { "run() has been invoked on remote node; creating STDIO connector" }; + my ($class, %args) = @_; + log_trace { "run() has been invoked on remote node" }; + + if ($args{watchdog_timeout}) { + Object::Remote::WatchDog->new(timeout => $args{watchdog_timeout}); + } + my $c = Object::Remote::Connector::STDIO->new->connect; - + $c->register_class_call_handler; my $loop = Object::Remote->current_loop; - + $c->on_close->on_ready(sub { log_info { "Node connection with call handler has closed" }; $loop->want_stop }); + Dlog_trace { "Node is sending 'Shere' to $_" } $c->send_to_fh; print { $c->send_to_fh } "Shere\n"; log_debug { "Node is going to start the run loop" };