/[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

revision 197 by dpavlin, Mon Nov 12 22:03:01 2007 UTC revision 205 by dpavlin, Wed Nov 14 23:02:17 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  session
11  background  background
12  debug  debug
13    
# 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 => {          session => { ... },
                 module => 'DBMDeep',  
                 path => 'var/',  
         },  
34          background => 1,          background => 1,
35          debug => 1          debug => 1
36    });    });
# Line 46  Options: Line 43  Options:
43    
44  port to listen on  port to listen on
45    
46  =item store  =item session
47    
48  hash with key C<module> with value C<DBMDeep> if L<CWMP::Store::DBMDeep>  hash with key C<module> with value C<DBMDeep> if L<CWMP::Store::DBMDeep>
49  is used. Other parametars are optional.  is used. Other parametars are optional.
# Line 70  sub new { Line 67  sub new {
67                  CWMP::Server::Helper->new({                  CWMP::Server::Helper->new({
68                          proto => 'tcp',                          proto => 'tcp',
69                          port => $self->port,                          port => $self->port,
70                          store => $self->store,                          session => $self->session,
71                          debug => $self->debug,                          debug => $self->debug,
72                          background => $self->background,                          background => $self->background,
73                  })                  })
# Line 107  sub options { Line 104  sub options {
104          $self->SUPER::options($template);          $self->SUPER::options($template);
105    
106          # new single-value options          # new single-value options
107          foreach my $p ( qw/ store debug / ) {          foreach my $p ( qw/ session debug / ) {
108                  $prop->{ $p } ||= undef;                  $prop->{ $p } ||= undef;
109                  $template->{ $p } = \$prop->{ $p };                  $template->{ $p } = \$prop->{ $p };
110          }          }
# Line 132  sub process_request { Line 129  sub process_request {
129          my $sock = $prop->{client};          my $sock = $prop->{client};
130          confess "no sock in ", ref( $self ) unless $sock;          confess "no sock in ", ref( $self ) unless $sock;
131    
132            my $sess = $prop->{session} || confess "no session";
133    
134          eval  {          eval  {
135                  my $session = CWMP::Session->new({                  $sess->{sock} = $sock;
136                          sock => $sock,                  $sess->{debug} = $prop->{debug};
137                          store => $prop->{store},  
138                          debug => $prop->{debug},                  warn "## sess = ", dump( $sess );
139                  }) || confess "can't create session";  
140                    my $session = CWMP::Session->new( $sess ) || confess "can't create session from ",dump( $sess );
141    
142                  while ( $session->process_request ) {                  while ( $session->process_request ) {
143                          warn "...waiting for next request from CPE...\n";                          warn "...waiting for next request from CPE...\n";
144                  }                  }
145          };          };
146    
147          if ($@) {          warn "ERROR: $@\n" if $@;
                 warn $@;  
         }  
148    
149          warn "...returning to accepting new connections\n";          warn "...returning to accepting new connections\n";
150    

Legend:
Removed from v.197  
changed lines
  Added in v.205

  ViewVC Help
Powered by ViewVC 1.1.26