/[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 472 by dpavlin, Tue Jan 5 00:25:34 2010 UTC revision 545 by dpavlin, Sat Oct 9 13:50:38 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 45  sub tftp_request { Line 45  sub tftp_request {
45    
46          warn 'request: ', dump( $request ) if $debug;          warn 'request: ', dump( $request ) if $debug;
47    
48            if ( my $pid = fork ) {
49                    # parent
50                    warn "# forked $pid\n";
51                    return;
52            }
53    
54    
55          my $ip = $request->{_REQUEST_}->{PeerAddr};          my $ip = $request->{_REQUEST_}->{PeerAddr};
56          config::for_ip( $ip );          config::for_ip( $ip );
57    
# Line 62  sub tftp_request { Line 69  sub tftp_request {
69                  path => $file,                  path => $file,
70                  state => 'start',                  state => 'start',
71          };          };
72          CouchDB::audit( $opcode, $audit );          store::audit( $opcode, $audit );
73    
74          progress_bar::start;          progress_bar::start;
75    
# Line 71  sub tftp_request { Line 78  sub tftp_request {
78                  my $size = -s "$dir/$file";                  my $size = -s "$dir/$file";
79                  $audit->{state} = 'finish';                  $audit->{state} = 'finish';
80                  $audit->{size} = $size;                  $audit->{size} = $size;
81                  CouchDB::audit( $opcode, $audit );                  store::audit( $opcode, $audit );
82          } else {          } else {
83                  $audit->{state} = 'error';                  $audit->{state} = 'error';
84                  $audit->{error} = Net::TFTPd->error;                  $audit->{error} = Net::TFTPd->error;
85                  CouchDB::audit( $opcode, $audit );                  store::audit( $opcode, $audit );
86          }          }
87    
88  }  }
# Line 101  sub start { Line 108  sub start {
108          my $listener = bless {          my $listener = bless {
109                  RootDir => $dir,                  RootDir => $dir,
110    
111                  ACKtimeout  => 4,                  ACKtimeout  => 1, # 4
112                  ACKretries  => 4,                  ACKretries  => 2, # 4
113                  Readable    => 1,                  Readable    => 1,
114                  Writable    => 0,                  Writable    => 0,
115                  Timeout => 3600,                  Timeout => 3600,
# Line 118  sub start { Line 125  sub start {
125    
126          warn 'listener: ',dump( $listener ) if $debug;          warn 'listener: ',dump( $listener ) if $debug;
127    
128          CouchDB::audit( 'start', {          store::audit( 'start', {
129                  addr => $listener->{LocalAddr},                  addr => $listener->{LocalAddr},
130                  port => $listener->{LocalPort},                  port => $listener->{LocalPort},
131                  timeout => $listener->{Timeout},                  timeout => $listener->{Timeout},

Legend:
Removed from v.472  
changed lines
  Added in v.545

  ViewVC Help
Powered by ViewVC 1.1.26