/[cwmp]/google/branches/store-pluggable/lib/CWMP/Session.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /google/branches/store-pluggable/lib/CWMP/Session.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 133 by dpavlin, Fri Oct 26 19:21:53 2007 UTC revision 134 by dpavlin, Fri Oct 26 20:46:09 2007 UTC
# Line 7  use warnings; Line 7  use warnings;
7  use base qw/Class::Accessor/;  use base qw/Class::Accessor/;
8  __PACKAGE__->mk_accessors( qw/  __PACKAGE__->mk_accessors( qw/
9  debug  debug
10  store_path  store
11    
12  sock  sock
13  state  state
# Line 34  CWMP::Session - implement logic of CWMP Line 34  CWMP::Session - implement logic of CWMP
34    
35    my $server = CWMP::Session->new({    my $server = CWMP::Session->new({
36          sock => $io_socket_object,          sock => $io_socket_object,
37          store_path => 'state.db',          store => 'state.db',
38          queue => [ qw/GetRPCMethods GetParameterNames/ ],          queue => [ qw/GetRPCMethods GetParameterNames/ ],
39          debug => 1,          debug => 1,
40    });    });
# Line 51  sub new { Line 51  sub new {
51    
52          warn "created ", __PACKAGE__, "(", dump( @_ ), ") for ", $self->sock->peerhost, "\n" if $self->debug;          warn "created ", __PACKAGE__, "(", dump( @_ ), ") for ", $self->sock->peerhost, "\n" if $self->debug;
53    
54          $self->store( CWMP::Store->new({          my $store_obj = CWMP::Store->new({
55                  debug => $self->debug,                  debug => $self->debug,
56                  path => $self->store_path,                  %{ $self->store },
57          }) );          });
58    
59            croak "can't open ", dump( $self->store ), ": $!" unless $store_obj;
60    
61          croak "can't open ", $self->store_path, ": $!" unless $self->store;          # FIXME looks ugly. Should we have separate accessor for this?
62            $self->store( $store_obj );
63    
64          return $self;          return $self;
65  }  }
# Line 122  sub process_request { Line 125  sub process_request {
125    
126          } else {          } else {
127    
128                  warn "## empty request\n";                  warn "## empty request, using last request state\n";
129    
130                  $state = $self->state;                  $state = $self->state;
131                  delete( $state->{_dispatch} );                  delete( $state->{_dispatch} );
132                  warn "last request state = ", dump( $state ), "\n" if $self->debug > 1;                  #warn "last request state = ", dump( $state ), "\n" if $self->debug > 1;
133          }          }
134    
135    
# Line 146  sub process_request { Line 149  sub process_request {
149          } elsif ( $dispatch = shift @{ $self->queue } ) {          } elsif ( $dispatch = shift @{ $self->queue } ) {
150                  $xml = $self->dispatch( $dispatch );                  $xml = $self->dispatch( $dispatch );
151          } elsif ( $size == 0 ) {          } elsif ( $size == 0 ) {
152                  warn ">>> closing connection\n";                  warn ">>> no more queued commands, closing connection\n";
153                  return 0;                  return 0;
154          } else {          } else {
155                  warn ">>> empty response\n";                  warn ">>> empty response\n";

Legend:
Removed from v.133  
changed lines
  Added in v.134

  ViewVC Help
Powered by ViewVC 1.1.26