From b1f0ff50033a9e8f2fbc75828452baa41ff83608 Mon Sep 17 00:00:00 2001 From: Ole Martin Eide Date: Sat, 27 Oct 2007 17:57:40 +0000 Subject: [PATCH] Eval wrapping in process_request, should not die on session based exception. Added GetParameterValues. git-svn-id: https://perl-cwmp.googlecode.com/svn/trunk@140 836a5e1a-633d-0410-964b-294494ad4392 --- Makefile.PL | 1 - lib/CWMP/Response.pm | 21 +++++++++++++++++++++ lib/CWMP/Server.pm | 24 +++++++++++++++--------- 3 files changed, 36 insertions(+), 10 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index d346367..2766ab1 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -27,4 +27,3 @@ clean_files('dump/*'); auto_install; WriteAll; - diff --git a/lib/CWMP/Response.pm b/lib/CWMP/Response.pm index 6b2a866..10303b2 100644 --- a/lib/CWMP/Response.pm +++ b/lib/CWMP/Response.pm @@ -101,6 +101,27 @@ sub GetParameterNames { }); } +=head2 GetParameterValues { + + $response->GetParameterValues( $state, $ParameterPath, $NextLevel ); + +=cut + +sub GetParameterValues { + my ( $self, $state, $ParameterPath, $NextLevel ) = @_; + $ParameterPath ||= ''; # all + $NextLevel ||= 0; # all + warn "# GetParameterValues( '$ParameterPath', $NextLevel )\n" if $self->debug; + $self->xml( $state, sub { + my ( $X, $state ) = @_; + + $X->GetParameterValues( $cwmp, + $X->ParameterPath( $cwmp, $ParameterPath ), + $X->NextLevel( $cwmp, $NextLevel ), + ); + }); +} + =head2 xml Used to implement methods which modify just body of soap message. diff --git a/lib/CWMP/Server.pm b/lib/CWMP/Server.pm index 0a67293..51a520a 100644 --- a/lib/CWMP/Server.pm +++ b/lib/CWMP/Server.pm @@ -136,15 +136,21 @@ sub process_request { warn "default CPE queue ( " . join(",",@{$prop->{default_queue}}) . " )\n" if defined($prop->{default_queue}); - my $session = CWMP::Session->new({ - sock => $sock, - queue => $prop->{default_queue}, - store_path => $prop->{store_path}, - debug => $prop->{debug}, - }) || confess "can't create session"; - - while ( $session->process_request ) { - warn "...another one bites the dust...\n"; + eval { + my $session = CWMP::Session->new({ + sock => $sock, + queue => $prop->{default_queue}, + store_path => $prop->{store_path}, + debug => $prop->{debug}, + }) || confess "can't create session"; + + while ( $session->process_request ) { + warn "...another one bites the dust...\n"; + } + }; + + if ($@) { + warn $@; } warn "...returning to accepting new connections\n"; -- 2.20.1