X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FObject%2FRemote%2FMiniLoop.pm;h=faa4a38d371911d60ecfaa452447ba3f8eb5c772;hb=052976d4a389b826a9551909492f3fc2f2312c88;hp=ab8e85a1fdb9751b7b5a9213340ac112ba6e2cc4;hpb=8d757beb3bd870615c5a5b3076f7dc72ae9cc637;p=scpubgit%2FObject-Remote.git diff --git a/lib/Object/Remote/MiniLoop.pm b/lib/Object/Remote/MiniLoop.pm index ab8e85a..faa4a38 100644 --- a/lib/Object/Remote/MiniLoop.pm +++ b/lib/Object/Remote/MiniLoop.pm @@ -2,9 +2,15 @@ package Object::Remote::MiniLoop; use IO::Select; use Time::HiRes qw(time); -use Object::Remote::Logging qw( :log :dlog ); +use Object::Remote::Logging qw( :log :dlog router ); use Moo; +BEGIN { + $SIG{PIPE} = sub { log_debug { "Got a PIPE signal" } }; + + router()->exclude_forwarding +} + # this is ro because we only actually set it using local in sub run has is_running => (is => 'ro', clearer => 'stop'); #maximum duration that select() will block - undef means indefinite, @@ -140,8 +146,10 @@ sub loop_once { my $write_count = 0; my @c = caller; my $wait_time = $self->_next_timer_expires_delay; - log_trace { sprintf("Run loop: loop_once() has been invoked by $c[1]:$c[2] with read:%i write:%i select timeout:%s", - scalar(keys(%$read)), scalar(keys(%$write)), defined $wait_time ? $wait_time : 'indefinite' ) }; + log_trace { + sprintf("Run loop: loop_once() has been invoked by $c[1]:$c[2] with read:%i write:%i select timeout:%s", + scalar(keys(%$read)), scalar(keys(%$write)), defined $wait_time ? $wait_time : 'indefinite' ) + }; my ($readable, $writeable) = IO::Select->select( $self->_read_select, $self->_write_select, undef, $wait_time ); @@ -201,7 +209,7 @@ sub loop_once { sub want_run { my ($self) = @_; - Dlog_debug { "Run loop: Incrimenting want_running, is now $_" } + Dlog_debug { "Run loop: Incremeting want_running, is now $_" } ++$self->{want_running}; }