From: miker Date: Wed, 30 Aug 2006 00:35:12 +0000 (+0000) Subject: chopping up dup messages in Client::process() X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=482710d8920d4ab5069fc6cb91be467e8744a77b;p=opensrf%2Fbjwebb.git chopping up dup messages in Client::process() git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@771 9efc2488-bf62-4759-914b-345cdb29e865 --- diff --git a/src/perlmods/OpenSRF/Transport/SlimJabber/Client.pm b/src/perlmods/OpenSRF/Transport/SlimJabber/Client.pm index b90e172..d67e77d 100644 --- a/src/perlmods/OpenSRF/Transport/SlimJabber/Client.pm +++ b/src/perlmods/OpenSRF/Transport/SlimJabber/Client.pm @@ -192,6 +192,7 @@ sub timed_read { $self->{temp_buffer} = ''; my ($tag) = ($buffer =~ /<([^\s\?\>]+)/o); + $self->{last_tag} = $tag; $logger->transport("Using tag: $tag ", INTERNAL); if ( $buffer =~ /^(.*?<\/$tag>){1}(.*)/s) { @@ -285,7 +286,8 @@ sub timed_read { if ($first_read) { $logger->transport(" First read Buffer\n [$buffer]", INTERNAL); - ($tag) = ($buffer =~ /<([^\s\?\>]+){1}/o); + ($tag) = ($buffer =~ /<([^\s\?\>\/]+){1}/o); + $self->{last_tag} = $tag; $first_read--; $logger->transport("Using tag: $tag ", INTERNAL); } @@ -563,6 +565,18 @@ sub process { "Call to Client->timed_read( $timeout ) successfully returned data", INTERNAL ); } + my $t = $self->{last_tag}; + my @msgs = $val =~ /(<$t[^>]*>.*?<\/$t>)/g; + $val = shift(@msgs); + + if (@msgs) { + my $tmp = $self->{temp_buffer}; + + $self->{temp_buffer} = ''; + $self->{temp_buffer} .= $_ for (@msgs); + $self->{temp_buffer} .= $tmp; + } + return $val; }