--- lib/PXElator/tftpd.pm 2009/08/12 22:56:45 207 +++ lib/PXElator/tftpd.pm 2009/08/12 23:59:01 208 @@ -58,20 +58,26 @@ my $file = $request->{'_REQUEST_'}{'FileName'}; my $opcode = $OPCODES{$request->{'_REQUEST_'}{'OPCODE'}}; - CouchDB::audit('request', { + my $audit = { ip => $ip, opcode => $opcode, file => $file, - }); + state => 'start', + }; + CouchDB::audit( $opcode, $audit ); progress_bar::start; # process the request if( $request->processRQ() ) { my $size = -s "$dir/$file"; - CouchDB::audit('completed', { file => $file, size => $size }); + $audit->{state} = 'finish'; + $audit->{size} = $size; + CouchDB::audit( $opcode, $audit ); } else { - CouchDB::audit('error', { file => $file, error => Net::TFTPd->error }); + $audit->{state} = 'error'; + $audit->{error} = Net::TFTPd->error; + CouchDB::audit( $opcode, $audit ); $request->processRQ(); }