From 0eef6d1c25d858d411813a9e8fe33750c1de7858 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Sun, 28 Oct 2007 19:45:19 +0000 Subject: [PATCH] create symlinks based on _dispatch to dumped requsts git-svn-id: https://perl-cwmp.googlecode.com/svn/trunk@176 836a5e1a-633d-0410-964b-294494ad4392 --- lib/CWMP/Session.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/CWMP/Session.pm b/lib/CWMP/Session.pm index fd50a53..f30dc59 100644 --- a/lib/CWMP/Session.pm +++ b/lib/CWMP/Session.pm @@ -107,8 +107,10 @@ sub process_request { warn "<<<< ", $sock->peerhost, " [" . localtime() . "] ", $r->method, " ", $r->uri, " $size bytes\n"; + $dump_nr++; + my $file = sprintf("dump/%04d-%s.request", $dump_nr, $sock->peerhost); + if ( $self->debug > 2 ) { - my $file = sprintf("dump/%04d-%s.request", $dump_nr++, $sock->peerhost); write_file( $file, $r->as_string ); warn "### request dumped to file: $file\n"; } @@ -123,6 +125,11 @@ sub process_request { $state = CWMP::Request->parse( $xml ); + if ( defined( $state->{_dispatch} ) && $self->debug > 2 ) { + my $type = sprintf("dump/%04d-%s-%s", $dump_nr, $sock->peerhost, $state->{_dispatch}); + symlink $file, $type || warn "can't symlink $file -> $type: $!"; + } + warn "## acquired state = ", dump( $state ), "\n"; $self->state( $state ); -- 2.20.1