X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FObject%2FRemote%2FRole%2FConnector.pm;h=a4bce2e426d28bf498004e8e1370a28c6130e2cd;hb=29fb87a40b2ebc799be9bee9f400b07c95350fe9;hp=d5d46d76d10a066c8078ec60313e3a3f439758bf;hpb=9031635d18e754da303557b656c63ce8e7eb8e77;p=scpubgit%2FObject-Remote.git diff --git a/lib/Object/Remote/Role/Connector.pm b/lib/Object/Remote/Role/Connector.pm index d5d46d7..a4bce2e 100644 --- a/lib/Object/Remote/Role/Connector.pm +++ b/lib/Object/Remote/Role/Connector.pm @@ -7,13 +7,11 @@ use Moo::Role; requires '_open2_for'; -#TODO return to 10 seconds after debugging -#has timeout => (is => 'ro', default => sub { { after => 10 } }); -has timeout => (is => 'ro', default => sub { { after => 10 } }); +has timeout => (is => 'ro', default => sub { 10 }); sub connect { my $self = shift; - Dlog_debug { "Perparing to create connection with args of: $_" } @_; + Dlog_debug { "Preparing to create connection with args of: $_" } @_; my ($send_to_fh, $receive_from_fh, $child_pid) = $self->_open2_for(@_); my $channel = use_module('Object::Remote::ReadChannel')->new( fh => $receive_from_fh @@ -38,17 +36,15 @@ sub connect { undef($channel); }); $channel->on_close_call(sub { + log_trace { "Connection has been closed" }; $f->fail("Channel closed without seeing Shere: $_[0]"); undef($channel); }); log_trace { "initialized events on channel for child pid '$child_pid'; creating timeout" }; Object::Remote->current_loop ->watch_time( - %{$self->timeout}, + after => $self->timeout, code => sub { -# log_warn { "Connection timed out for child pid '$child_pid'" }; -# $f->fail("Connection timed out") unless $f->is_ready; -# undef($channel); Dlog_trace { "Connection timeout timer has fired for child pid '$child_pid'; is_ready: $_" } $f->is_ready; unless($f->is_ready) { log_warn { "Connection with child pid '$child_pid' has timed out" };