/[cwmp]/google/trunk/lib/CWMP/Server.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/trunk/lib/CWMP/Server.pm

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

google/lib/CWMP/Server.pm revision 101 by dpavlin, Sun Jun 24 18:32:58 2007 UTC google/trunk/lib/CWMP/Server.pm revision 171 by dpavlin, Sun Oct 28 15:00:19 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  port  port
10  store_path  store
11  default_queue  default_queue
12  background  background
13  debug  debug
# Line 30  CWMP::Server - description Line 30  CWMP::Server - description
30    
31    my $server = CWMP::Server->new({    my $server = CWMP::Server->new({
32          port => 3333,          port => 3333,
33          store_path => 'state.db',          store => {
34                    module => 'DBMDeep',
35                    path => 'var/',
36            },
37          default_queue => [ qw/GetRPCMethods GetParameterNames/ ],                                                                    default_queue => [ qw/GetRPCMethods GetParameterNames/ ],                                                          
38          background => 1,          background => 1,
39          debug => 1          debug => 1
# Line 44  Options: Line 47  Options:
47    
48  port to listen on  port to listen on
49    
50  =item store_path  =item store
51    
52  path to L<DBM::Deep> database file to preserve state  hash with key C<module> with value C<DBMDeep> if L<CWMP::Store::DBMDeep>
53    is used. Other parametars are optional.
54    
55  =item default_queue  =item default_queue
56    
# Line 72  sub new { Line 76  sub new {
76                          proto => 'tcp',                          proto => 'tcp',
77                          port => $self->port,                          port => $self->port,
78                          default_queue => $self->default_queue,                          default_queue => $self->default_queue,
79                          store_path => $self->store_path,                          store => $self->store,
80                          debug => $self->debug,                          debug => $self->debug,
81                          background => $self->background,                          background => $self->background,
82                  })                  })
# Line 109  sub options { Line 113  sub options {
113          $self->SUPER::options($template);          $self->SUPER::options($template);
114    
115          # new single-value options          # new single-value options
116          foreach my $p ( qw/ store_path debug / ) {          foreach my $p ( qw/ store debug / ) {
117                  $prop->{ $p } ||= undef;                  $prop->{ $p } ||= undef;
118                  $template->{ $p } = \$prop->{ $p };                  $template->{ $p } = \$prop->{ $p };
119          }          }
# Line 134  sub process_request { Line 138  sub process_request {
138          my $sock = $prop->{client};          my $sock = $prop->{client};
139          confess "no sock in ", ref( $self ) unless $sock;          confess "no sock in ", ref( $self ) unless $sock;
140    
141          warn "default CPE queue ( " . join(",",@{$prop->{default_queue}}) . " )\n" if defined($prop->{default_queue});          warn "default CPE queue ", dump( $prop->{default_queue} ), "\n" if defined($prop->{default_queue});
142    
143          my $session = CWMP::Session->new({          eval  {
144                  sock => $sock,                  my $session = CWMP::Session->new({
145                  queue => $prop->{default_queue},                          sock => $sock,
146                  store_path => $prop->{store_path},                          queue => $prop->{default_queue},
147                  debug => $prop->{debug},                          store => $prop->{store},
148          }) || confess "can't create session";                          debug => $prop->{debug},
149                    }) || confess "can't create session";
150    
151                    while ( $session->process_request ) {
152                            warn "...another one bites the dust...\n";
153                    }
154            };
155    
156          while ( $session->process_request ) {          if ($@) {
157                  warn "...another one bites the dust...\n";                  warn $@;
158          }          }
159    
160          warn "...returning to accepting new connections\n";          warn "...returning to accepting new connections\n";

Legend:
Removed from v.101  
changed lines
  Added in v.171

  ViewVC Help
Powered by ViewVC 1.1.26