From 062ba4a3eed246b5f782eb61669f2a187939e99b Mon Sep 17 00:00:00 2001 From: Joshua Roys Date: Tue, 19 Aug 2008 05:13:58 -0400 Subject: [PATCH] Add some status debug messages to 'Play' This is merely to see the progress for the script bin/gtp-adhoc.pl . This will probably be removed later, or at least moved to a more appropriate location. --- lib/VCS/Git/Torrent/PWP/Message/Play.pm | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/lib/VCS/Git/Torrent/PWP/Message/Play.pm b/lib/VCS/Git/Torrent/PWP/Message/Play.pm index a3e6317..7d82a67 100644 --- a/lib/VCS/Git/Torrent/PWP/Message/Play.pm +++ b/lib/VCS/Git/Torrent/PWP/Message/Play.pm @@ -122,6 +122,34 @@ sub action { || die 'failed to save pack file'; syswrite PACK, $self->data, $self->data_len; close(PACK); + + my $reel; + + foreach( @{ $local_peer->torrent->reels } ) { + $reel = $_; + + last if ( + $reel->reel_id->[0] eq $start && + $reel->reel_id->[1] eq $end + ); + } + + if ( $reel && $ENV{'PLAY_STATUS'} ) { + print STDERR "\rreceived commit " . + ( $self->offset + 1 ) . + "/" . + @{ $reel->commit_info } . + + ' (' . + int( 100 * ( $self->offset + 1 ) / + @{ $reel->commit_info } ) . + ") "; + + print STDERR "\n" if ( + ( $self->offset + 1 ) == + @{ $reel->commit_info } + ); + } } else { # it was a request for data my $reel; -- 2.11.4.GIT