r230@brr: dpavlin | 2007-11-18 17:42:53 +0100
[perl-cwmp.git] / lib / CWMP / Session.pm
index 3139cbb..6256f57 100644 (file)
@@ -113,7 +113,7 @@ sub process_request {
 
        if ( $self->create_dump ) {
                write_file( $file, $r->as_string );
-               warn "### request dumped to file: $file\n";
+               warn "### request dumped to file: $file\n" if $self->debug;
        }
 
        my $state;
@@ -131,7 +131,7 @@ sub process_request {
                        symlink $file, $type || warn "can't symlink $file -> $type: $!";
                }
 
-               warn "## acquired state = ", dump( $state ), "\n";
+               warn "## acquired state = ", dump( $state ), "\n" if $self->debug;
 
                if ( ! defined( $state->{DeviceID} ) ) {
                        warn "## state with DeviceID, using old one...\n";
@@ -139,7 +139,7 @@ sub process_request {
                }
 
                $self->state( $state );
-               $self->store->update_state( ID => $state->{ID}, $state );
+               $self->store->update_state( $state );
 
        } else {
 
@@ -160,7 +160,7 @@ sub process_request {
 
        $sock->send( "Set-Cookie: ID=" . $state->{ID} . "; path=/\r\n" ) if ( $state->{ID} );
 
-       my $uid = $self->store->ID_to_uid( $state->{ID}, $state );
+       my $uid = $self->store->state_to_uid( $state );
 
        my $queue = CWMP::Queue->new({
                id => $uid,
@@ -204,8 +204,6 @@ If debugging level of 3 or more, it will create dumps of responses named C<< dum
 sub dispatch {
        my $self = shift;
 
-warn "##!!! dispatch(",dump( @_ ),")\n";
-
        my $dispatch = shift || die "no dispatch?";
        my $args = shift;
 
@@ -218,7 +216,7 @@ warn "##!!! dispatch(",dump( @_ ),")\n";
                if ( $self->create_dump ) {
                        my $file = sprintf("dump/%04d-%s.response", $dump_nr++, $self->sock->peerhost);
                        write_file( $file, $xml );
-                       warn "### response dump: $file\n";
+                       warn "### response dump: $file\n" if $self->debug;
                }
                return $xml;
        } else {