X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FObject%2FRemote%2FRole%2FConnector.pm;h=d3b43c56690886fb2086ca5ee5bfcb8e1bad6870;hb=b49a063d7885c23278585e52c3066c791f8934f2;hp=83bfcea205d2055533c433022ea6138f22254627;hpb=5d59cb9859e004df5cde5d83aa7230e621a28b95;p=scpubgit%2FObject-Remote.git diff --git a/lib/Object/Remote/Role/Connector.pm b/lib/Object/Remote/Role/Connector.pm index 83bfcea..d3b43c5 100644 --- a/lib/Object/Remote/Role/Connector.pm +++ b/lib/Object/Remote/Role/Connector.pm @@ -11,7 +11,7 @@ has timeout => (is => 'ro', default => sub { { after => 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 @@ -36,6 +36,7 @@ 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); }); @@ -44,17 +45,13 @@ sub connect { ->watch_time( %{$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" }; - $f->fail("Connection timed out") unless $f->is_ready; + $f->fail("Connection timed out") unless $f->is_ready; } - #TODO hrm was this supposed to be conditional on the is_ready ? - #a connection is only good for timeout seconds? undef($channel); + } ); log_trace { "connection for child pid '$child_pid' has been initialized" };