projects
/
perl-cwmp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
r140@llin (orig r139): dpavlin | 2007-10-27 12:13:01 +0200
[perl-cwmp.git]
/
lib
/
CWMP
/
Session.pm
diff --git
a/lib/CWMP/Session.pm
b/lib/CWMP/Session.pm
index
41e99d1
..
bd24efd
100644
(file)
--- a/
lib/CWMP/Session.pm
+++ b/
lib/CWMP/Session.pm
@@
-7,7
+7,7
@@
use warnings;
use base qw/Class::Accessor/;
__PACKAGE__->mk_accessors( qw/
debug
use base qw/Class::Accessor/;
__PACKAGE__->mk_accessors( qw/
debug
-store
_path
+store
sock
state
sock
state
@@
-34,7
+34,7
@@
CWMP::Session - implement logic of CWMP protocol
my $server = CWMP::Session->new({
sock => $io_socket_object,
my $server = CWMP::Session->new({
sock => $io_socket_object,
- store
_path
=> 'state.db',
+ store => 'state.db',
queue => [ qw/GetRPCMethods GetParameterNames/ ],
debug => 1,
});
queue => [ qw/GetRPCMethods GetParameterNames/ ],
debug => 1,
});
@@
-51,12
+51,15
@@
sub new {
warn "created ", __PACKAGE__, "(", dump( @_ ), ") for ", $self->sock->peerhost, "\n" if $self->debug;
warn "created ", __PACKAGE__, "(", dump( @_ ), ") for ", $self->sock->peerhost, "\n" if $self->debug;
-
$self->store(
CWMP::Store->new({
+
my $store_obj =
CWMP::Store->new({
debug => $self->debug,
debug => $self->debug,
- path => $self->store_path,
- }) );
+ %{ $self->store },
+ });
+
+ croak "can't open ", dump( $self->store ), ": $!" unless $store_obj;
- croak "can't open ", $self->store_path, ": $!" unless $self->store;
+ # FIXME looks ugly. Should we have separate accessor for this?
+ $self->store( $store_obj );
return $self;
}
return $self;
}
@@
-122,11
+125,11
@@
sub process_request {
} else {
} else {
- warn "## empty request\n";
+ warn "## empty request
, using last request state
\n";
$state = $self->state;
delete( $state->{_dispatch} );
$state = $self->state;
delete( $state->{_dispatch} );
- warn "last request state = ", dump( $state ), "\n" if $self->debug > 1;
+
#
warn "last request state = ", dump( $state ), "\n" if $self->debug > 1;
}
}
@@
-146,7
+149,7
@@
sub process_request {
} elsif ( $dispatch = shift @{ $self->queue } ) {
$xml = $self->dispatch( $dispatch );
} elsif ( $size == 0 ) {
} elsif ( $dispatch = shift @{ $self->queue } ) {
$xml = $self->dispatch( $dispatch );
} elsif ( $size == 0 ) {
- warn ">>> closing connection\n";
+ warn ">>>
no more queued commands,
closing connection\n";
return 0;
} else {
warn ">>> empty response\n";
return 0;
} else {
warn ">>> empty response\n";