X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FObject%2FRemote%2FReadChannel.pm;h=456e5aacc16c5b28ed635753f8e02758b99d24af;hb=b49a063d7885c23278585e52c3066c791f8934f2;hp=6bfc3694533508204d7edd70f1a6bd84a73cd72c;hpb=c824fdf36c659b3b6dbafe23a3021f2b1d6eeb3f;p=scpubgit%2FObject-Remote.git diff --git a/lib/Object/Remote/ReadChannel.pm b/lib/Object/Remote/ReadChannel.pm index 6bfc369..456e5aa 100644 --- a/lib/Object/Remote/ReadChannel.pm +++ b/lib/Object/Remote/ReadChannel.pm @@ -1,11 +1,12 @@ package Object::Remote::ReadChannel; use CPS::Future; -use Scalar::Util qw(weaken); -use Object::Remote::Logging qw(:log :dlog); -use POSIX; +use Scalar::Util qw(weaken openhandle); +use Object::Remote::Logging qw(:log :dlog get_router ); use Moo; +BEGIN { get_router()->exclude_forwarding } + has fh => ( is => 'ro', required => 1, trigger => sub { @@ -39,10 +40,7 @@ sub _receive_data_from { while (my $cb = $self->on_line_call and $$rb =~ s/^(.*)\n//) { $cb->(my $line = $1); } - #TODO this isn't compatible with Windows but would be if - #EAGAIN was set to something that could never match - #if on Windows - } elsif ($! != EAGAIN) { + } else { log_trace { "Got EOF or error, this read channel is done" }; Object::Remote->current_loop ->unwatch_io( @@ -58,11 +56,14 @@ sub DEMOLISH { my ($self, $gd) = @_; return if $gd; log_trace { "read channel is being demolished" }; + Object::Remote->current_loop ->unwatch_io( handle => $self->fh, on_read_ready => 1 ); + + } 1;