113 |
|
|
114 |
if ( $self->create_dump ) { |
if ( $self->create_dump ) { |
115 |
write_file( $file, $r->as_string ); |
write_file( $file, $r->as_string ); |
116 |
warn "### request dumped to file: $file\n"; |
warn "### request dumped to file: $file\n" if $self->debug; |
117 |
} |
} |
118 |
|
|
119 |
my $state; |
my $state; |
131 |
symlink $file, $type || warn "can't symlink $file -> $type: $!"; |
symlink $file, $type || warn "can't symlink $file -> $type: $!"; |
132 |
} |
} |
133 |
|
|
134 |
warn "## acquired state = ", dump( $state ), "\n"; |
warn "## acquired state = ", dump( $state ), "\n" if $self->debug; |
135 |
|
|
136 |
if ( ! defined( $state->{DeviceID} ) ) { |
if ( ! defined( $state->{DeviceID} ) ) { |
137 |
warn "## state with DeviceID, using old one...\n"; |
warn "## state with DeviceID, using old one...\n"; |
139 |
} |
} |
140 |
|
|
141 |
$self->state( $state ); |
$self->state( $state ); |
142 |
$self->store->update_state( ID => $state->{ID}, $state ); |
$self->store->update_state( $state ); |
143 |
|
|
144 |
} else { |
} else { |
145 |
|
|
160 |
|
|
161 |
$sock->send( "Set-Cookie: ID=" . $state->{ID} . "; path=/\r\n" ) if ( $state->{ID} ); |
$sock->send( "Set-Cookie: ID=" . $state->{ID} . "; path=/\r\n" ) if ( $state->{ID} ); |
162 |
|
|
163 |
my $uid = $self->store->ID_to_uid( $state->{ID}, $state ); |
my $uid = $self->store->state_to_uid( $state ); |
164 |
|
|
165 |
my $queue = CWMP::Queue->new({ |
my $queue = CWMP::Queue->new({ |
166 |
id => $uid, |
id => $uid, |
216 |
if ( $self->create_dump ) { |
if ( $self->create_dump ) { |
217 |
my $file = sprintf("dump/%04d-%s.response", $dump_nr++, $self->sock->peerhost); |
my $file = sprintf("dump/%04d-%s.response", $dump_nr++, $self->sock->peerhost); |
218 |
write_file( $file, $xml ); |
write_file( $file, $xml ); |
219 |
warn "### response dump: $file\n"; |
warn "### response dump: $file\n" if $self->debug; |
220 |
} |
} |
221 |
return $xml; |
return $xml; |
222 |
} else { |
} else { |