78 |
my $last_t = $start_t; |
my $last_t = $start_t; |
79 |
|
|
80 |
while( my $len = read $fh, $buff, $block ) { |
while( my $len = read $fh, $buff, $block ) { |
81 |
syswrite $client,$buff; |
print $client $buff; |
82 |
$client->flush; |
$client->flush; |
83 |
$pos += $len; |
$pos += $len; |
84 |
my $t = time(); |
my $t = time(); |
85 |
next unless $t - $last_t > 0.75; |
next unless $t - $last_t > 0.75; |
86 |
$last_t = $t; |
$last_t = $t; |
87 |
my $speed = ( $pos ) / ( $t - $start_t ); |
my $speed = ( $pos ) / ( $t - $start_t ); |
88 |
printf STDERR "%s %d/%d %.2f%% %.2f K/s ETA %.1fs\r" |
printf STDERR "%s %d/%d %.2f%% %.2f K/s ETA %.1fs \r" |
89 |
, $path, $pos |
, $path, $pos |
90 |
, $size, $pos * 100 / $size |
, $size, $pos * 100 / $size |
91 |
, $speed / 1024 |
, $speed / 1024 |
97 |
|
|
98 |
print STDERR "\n"; |
print STDERR "\n"; |
99 |
|
|
100 |
exit; |
warn "exit static child"; |
101 |
|
|
102 |
|
exit(0); |
103 |
} |
} |
104 |
|
|
105 |
use boolean; |
use boolean; |