/[pxelator]/lib/PXElator/tftpd.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /lib/PXElator/tftpd.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 114 by dpavlin, Sun Aug 2 02:04:00 2009 UTC revision 115 by dpavlin, Sun Aug 2 12:09:02 2009 UTC
# Line 23  sub path { Line 23  sub path {
23  }  }
24    
25  STDERR->autoflush(1);  STDERR->autoflush(1);
26    use progress_bar;
27    
28  sub transfer_status {  sub transfer_status {
29          my $req = shift;          my $request = shift;
30          if( $req->{'_REQUEST_'}{'OPCODE'} eq $OPCODES{'RRQ'} ) {          my $r = $request->{'_REQUEST_'} || die "no _REQUEST_ in ",dump( $request );
31                  printf STDERR "RRQ %s %u\/%u\r", map { $req->{_REQUEST_}->{$_} } ( 'FileName', 'LASTACK', 'LASTBLK' );  
32          } elsif ( $req->{'_REQUEST_'}{'OPCODE'} eq $OPCODES{'WRQ'} ) {          if( $r->{'OPCODE'} eq $OPCODES{'RRQ'} ) {
33                    progress_bar::tick( $r->{FileName}, $r->{BlkSize} * $r->{LASTACK}, $r->{BlkSize} * $r->{LASTBLK} );
34            } elsif ( $r->{'OPCODE'} eq $OPCODES{'WRQ'} ) {
35                  die "WRQ disabled";                  die "WRQ disabled";
                 printf STDERR "WRQ: %u\/%u\n", $req->{'_REQUEST_'}{'LASTBLK'}, $req->{'_REQUEST_'}{'LASTACK'};  
36          } else {          } else {
37                  warn "IGNORED: ", dump( $req );                  warn "IGNORED: ", dump( $request );
38          }          }
39  }  }
40    
# Line 52  sub tftp_request { Line 54  sub tftp_request {
54          # received request          # received request
55          print $OPCODES{$request->{'_REQUEST_'}{'OPCODE'}}, " $file\n";          print $OPCODES{$request->{'_REQUEST_'}{'OPCODE'}}, " $file\n";
56    
57            progress_bar::start;
58    
59          # process the request          # process the request
60          if( $request->processRQ() ) {          if( $request->processRQ() ) {
61                  print "\nOK completed $file ", -s "$dir/$file", "\n";                  print "\nOK completed $file ", -s "$dir/$file", "\n";

Legend:
Removed from v.114  
changed lines
  Added in v.115

  ViewVC Help
Powered by ViewVC 1.1.26