/[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 210 by dpavlin, Sun Nov 18 17:03:09 2007 UTC revision 223 by dpavlin, Sat Nov 24 02:17:40 2007 UTC
# Line 17  store Line 17  store
17    
18  use HTTP::Daemon;  use HTTP::Daemon;
19  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
20  use Carp qw/confess cluck croak/;  use Carp qw/carp confess cluck croak/;
21  use File::Slurp;  use File::Slurp;
22    
23  use CWMP::Request;  use CWMP::Request;
24  use CWMP::Methods;  use CWMP::Methods;
25  use CWMP::Store;  use CWMP::Store;
26    
27    #use Devel::LeakTrace::Fast;
28    
29  =head1 NAME  =head1 NAME
30    
31  CWMP::Session - implement logic of CWMP protocol  CWMP::Session - implement logic of CWMP protocol
# Line 100  sub process_request { Line 102  sub process_request {
102          # solution from http://use.perl.org/~Matts/journal/12896          # solution from http://use.perl.org/~Matts/journal/12896
103          ${*$sock}{'httpd_daemon'} = HTTP::Daemon->new;          ${*$sock}{'httpd_daemon'} = HTTP::Daemon->new;
104    
105          my $r = $sock->get_request || confess "can't get_request";          my $r = $sock->get_request;
106            
107            if ( ! $r ) {
108                    carp "can't get_request";
109                    return 0;
110            }
111    
112          my $xml = $r->content;          my $xml = $r->content;
113    
# Line 161  sub process_request { Line 168  sub process_request {
168    
169          my $uid = $self->store->state_to_uid( $state );          my $uid = $self->store->state_to_uid( $state );
170    
171          my $to_uid = join(" ", "to $uid",          my $to_uid = join(" ", grep { defined($_) } "to $uid",
172                          # board                          # board
173                          $state->{Parameter}->{'InternetGatewayDevice.DeviceInfo.HardwareVersion'},                          $state->{Parameter}->{'InternetGatewayDevice.DeviceInfo.HardwareVersion'},
174                          # version                          # version
# Line 182  sub process_request { Line 189  sub process_request {
189          } elsif ( $job = $queue->dequeue ) {          } elsif ( $job = $queue->dequeue ) {
190                  $xml = $self->dispatch( $job->dispatch );                  $xml = $self->dispatch( $job->dispatch );
191          } elsif ( $size == 0 ) {          } elsif ( $size == 0 ) {
192                  warn ">>> no more queued commands, closing connection $to_uid";                  warn ">>> no more queued commands, no client pending, closing connection $to_uid";
193                  return 0;                  $sock->close;
194                    return;
195          } else {          } else {
196                  warn ">>> empty response $to_uid";                  warn ">>> empty response $to_uid";
197                  $state->{NoMoreRequests} = 1;                  $state->{NoMoreRequests} = 1;

Legend:
Removed from v.210  
changed lines
  Added in v.223

  ViewVC Help
Powered by ViewVC 1.1.26