58 |
my $file = $request->{'_REQUEST_'}{'FileName'}; |
my $file = $request->{'_REQUEST_'}{'FileName'}; |
59 |
my $opcode = $OPCODES{$request->{'_REQUEST_'}{'OPCODE'}}; |
my $opcode = $OPCODES{$request->{'_REQUEST_'}{'OPCODE'}}; |
60 |
|
|
61 |
CouchDB::audit('request', { |
my $audit = { |
62 |
ip => $ip, |
ip => $ip, |
63 |
opcode => $opcode, |
opcode => $opcode, |
64 |
file => $file, |
file => $file, |
65 |
}); |
state => 'start', |
66 |
|
}; |
67 |
|
CouchDB::audit( $opcode, $audit ); |
68 |
|
|
69 |
progress_bar::start; |
progress_bar::start; |
70 |
|
|
71 |
# process the request |
# process the request |
72 |
if( $request->processRQ() ) { |
if( $request->processRQ() ) { |
73 |
my $size = -s "$dir/$file"; |
my $size = -s "$dir/$file"; |
74 |
CouchDB::audit('completed', { file => $file, size => $size }); |
$audit->{state} = 'finish'; |
75 |
|
$audit->{size} = $size; |
76 |
|
CouchDB::audit( $opcode, $audit ); |
77 |
} else { |
} else { |
78 |
CouchDB::audit('error', { file => $file, error => Net::TFTPd->error }); |
$audit->{state} = 'error'; |
79 |
|
$audit->{error} = Net::TFTPd->error; |
80 |
|
CouchDB::audit( $opcode, $audit ); |
81 |
$request->processRQ(); |
$request->processRQ(); |
82 |
} |
} |
83 |
|
|