/[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 261 by dpavlin, Wed Aug 19 10:58:02 2009 UTC revision 544 by dpavlin, Sat Oct 9 13:34:37 2010 UTC
# Line 6  use strict; Line 6  use strict;
6  use Net::TFTPd 0.03 qw(%OPCODES);  use Net::TFTPd 0.03 qw(%OPCODES);
7  use IO::Socket::INET;  use IO::Socket::INET;
8  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
9  use CouchDB;  use store;
10    
11  use server;  use server;
12    
# Line 59  sub tftp_request { Line 59  sub tftp_request {
59          my $audit = {          my $audit = {
60                  ip => $ip,                  ip => $ip,
61                  opcode => $opcode,                  opcode => $opcode,
62                  file => $file,                  path => $file,
63                  state => 'start',                  state => 'start',
64          };          };
65          CouchDB::audit( $opcode, $audit );          store::audit( $opcode, $audit );
66    
67          progress_bar::start;          progress_bar::start;
68    
# Line 71  sub tftp_request { Line 71  sub tftp_request {
71                  my $size = -s "$dir/$file";                  my $size = -s "$dir/$file";
72                  $audit->{state} = 'finish';                  $audit->{state} = 'finish';
73                  $audit->{size} = $size;                  $audit->{size} = $size;
74                  CouchDB::audit( $opcode, $audit );                  store::audit( $opcode, $audit );
75          } else {          } else {
76                  $audit->{state} = 'error';                  $audit->{state} = 'error';
77                  $audit->{error} = Net::TFTPd->error;                  $audit->{error} = Net::TFTPd->error;
78                  CouchDB::audit( $opcode, $audit );                  store::audit( $opcode, $audit );
                 $request->processRQ();  
79          }          }
80    
81  }  }
# Line 102  sub start { Line 101  sub start {
101          my $listener = bless {          my $listener = bless {
102                  RootDir => $dir,                  RootDir => $dir,
103    
104                  ACKtimeout  => 4,                  ACKtimeout  => 1, # 4
105                  ACKretries  => 4,                  ACKretries  => 2, # 4
106                  Readable    => 1,                  Readable    => 1,
107                  Writable    => 0,                  Writable    => 0,
108                  Timeout => 3600,                  Timeout => 3600,
109    
110                  CallBack => \&transfer_status,                  CallBack => \&transfer_status,
111  #               BlkSize => 8192,  #               BlkSize => 8192,
112  #               BlkSize => 512,                  BlkSize => 512,         # Dell's RAC doesn't like bigger packets
113                  BlkSize => 1456,        # IBM GE seems to be picky  #               BlkSize => 1456,        # IBM GE seems to be picky
114                  Debug => 99,                  Debug => 99,
115                  %params, # merge user parameters                  %params, # merge user parameters
116                  _UDPSERVER_ => $udpserver,                  _UDPSERVER_ => $udpserver,
# Line 119  sub start { Line 118  sub start {
118    
119          warn 'listener: ',dump( $listener ) if $debug;          warn 'listener: ',dump( $listener ) if $debug;
120    
121          CouchDB::audit( 'start', {          store::audit( 'start', {
122                  addr => $listener->{LocalAddr},                  addr => $listener->{LocalAddr},
123                  port => $listener->{LocalPort},                  port => $listener->{LocalPort},
124                  timeout => $listener->{Timeout},                  timeout => $listener->{Timeout},

Legend:
Removed from v.261  
changed lines
  Added in v.544

  ViewVC Help
Powered by ViewVC 1.1.26