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

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

revision 177 by dpavlin, Sun Oct 28 19:45:19 2007 UTC revision 197 by dpavlin, Mon Nov 12 22:03:01 2007 UTC
# Line 11  store Line 11  store
11    
12  sock  sock
13  state  state
 queue  
14  store  store
15  / );  / );
16    
# Line 35  CWMP::Session - implement logic of CWMP Line 34  CWMP::Session - implement logic of CWMP
34    my $server = CWMP::Session->new({    my $server = CWMP::Session->new({
35          sock => $io_socket_object,          sock => $io_socket_object,
36          store => 'state.db',          store => 'state.db',
         queue => [  
                 'GetRPCMethods',  
                 [ 'GetParameterValyes', 'InternetGatewayDevice.DeviceInfo.SerialNumber', 0 ],  
         ],  
37          debug => 1,          debug => 1,
38    });    });
39    
# Line 153  sub process_request { Line 148  sub process_request {
148          )."\r\n");          )."\r\n");
149    
150          $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} );
151            
152            my $queue = CWMP::Queue->new({
153                    id => $self->store->ID_to_uid( $state->{ID}, $state ),
154                    debug => $self->debug,
155            });
156            my $job;
157          $xml = '';          $xml = '';
158    
159          if ( my $dispatch = $state->{_dispatch} ) {          if ( my $dispatch = $state->{_dispatch} ) {
160                  $xml = $self->dispatch( $dispatch );                  $xml = $self->dispatch( $dispatch );
161          } elsif ( $dispatch = shift @{ $self->queue } ) {          } elsif ( $job = $queue->dequeue ) {
162                  $xml = $self->dispatch( $dispatch );                  $xml = $self->dispatch( $job->dispatch );
163          } elsif ( $size == 0 ) {          } elsif ( $size == 0 ) {
164                  warn ">>> no more queued commands, closing connection\n";                  warn ">>> no more queued commands, closing connection\n";
165                  return 0;                  return 0;
# Line 174  sub process_request { Line 174  sub process_request {
174    
175          warn ">>>> " . $sock->peerhost . " [" . localtime() . "] sent ", length( $xml )," bytes\n";          warn ">>>> " . $sock->peerhost . " [" . localtime() . "] sent ", length( $xml )," bytes\n";
176    
177            $job->finish if $job;
178          warn "### request over\n" if $self->debug;          warn "### request over\n" if $self->debug;
179    
180          return 1;       # next request          return 1;       # next request

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

  ViewVC Help
Powered by ViewVC 1.1.26