[OpenSRF-GIT] OpenSRF branch rel_2_2 updated. osrf_rel_2_2_1-5-geebe50f

Evergreen Git git at git.evergreen-ils.org
Mon Dec 16 11:20:59 EST 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "OpenSRF".

The branch, rel_2_2 has been updated
       via  eebe50f1b6835b108f70085a0199d835bc4d9623 (commit)
       via  8861f86b0183866a329531515935872628d8d2e6 (commit)
      from  899661bbfba59f719650077875afa813cc50f044 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit eebe50f1b6835b108f70085a0199d835bc4d9623
Author: Mike Rylander <mrylander at gmail.com>
Date:   Thu May 16 10:17:15 2013 -0400

    Protect subrequests from post-complete messages
    
    Subrequests (AKA method_lookup()-based API calls) sometimes append
    final-lvalue responses to the response list even after respond_complete()
    has been called from within the implementation method.  This commit
    discards all post-respond_complete values, protecting against extra,
    spurious values being returned to the ultimate client.
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/src/perl/lib/OpenSRF/AppSession.pm b/src/perl/lib/OpenSRF/AppSession.pm
index 8b99c00..9e371c7 100644
--- a/src/perl/lib/OpenSRF/AppSession.pm
+++ b/src/perl/lib/OpenSRF/AppSession.pm
@@ -1098,15 +1098,22 @@ package OpenSRF::AppSubrequest;
 
 sub respond {
 	my $self = shift;
+	return if $self->complete;
+
 	my $resp = shift;
 	push @{$$self{resp}}, $resp if (defined $resp);
 }
-sub respond_complete { respond(@_); }
+
+sub respond_complete {
+	my $self = shift;
+	$self->respond(@_);
+	$self->complete(1);
+}
 
 sub new {
 	my $class = shift;
 	$class = ref($class) || $class;
-	return bless({resp => [], @_}, $class);
+	return bless({complete => 0, resp => [], @_}, $class);
 }
 
 sub responses { @{$_[0]->{resp}} }
@@ -1118,6 +1125,13 @@ sub session {
 	return $x->{session};
 }
 
+sub complete {
+	my $x = shift;
+	my $c = shift;
+	$x->{complete} = $c if ($c);
+	return $x->{complete};
+}
+
 sub status {}
 
 

commit 8861f86b0183866a329531515935872628d8d2e6
Author: Galen Charlton <gmc at esilibrary.com>
Date:   Mon Dec 16 08:08:51 2013 -0800

    LP#1180849: test case - ignoring subrequest responses after respond_complete()
    
    This patch adds a regression test for verifying that subrequests
    ignore additional responses after respond_complete() is called.
    
    Signed-off-by: Galen Charlton <gmc at esilibrary.com>

diff --git a/src/perl/t/02-AppSession.t b/src/perl/t/02-AppSession.t
index 01cce39..5a88b2c 100644
--- a/src/perl/t/02-AppSession.t
+++ b/src/perl/t/02-AppSession.t
@@ -2,7 +2,7 @@
 
 use strict;
 use warnings;
-use Test::More tests => 3;
+use Test::More tests => 4;
 
 BEGIN {
 	use_ok( 'OpenSRF::AppSession' );
@@ -12,3 +12,11 @@ my $locale = OpenSRF::AppSession->default_locale('fr-CA');
 is($locale, 'fr-CA', 'got back the default locale we set');
 $locale = OpenSRF::AppSession->reset_locale();
 is($locale, 'en-US', 'got back en-US after reset of default locale');
+
+my $subreq = OpenSRF::AppSubrequest->new();
+$subreq->respond('a');
+$subreq->respond('b');
+$subreq->respond_complete();
+$subreq->respond('c');
+my @responses = $subreq->responses();
+is_deeply(\@responses, ['a', 'b'], 'further responses ignored after respond_complete() is called');

-----------------------------------------------------------------------

Summary of changes:
 src/perl/lib/OpenSRF/AppSession.pm |   18 ++++++++++++++++--
 src/perl/t/02-AppSession.t         |   10 +++++++++-
 2 files changed, 25 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
OpenSRF


More information about the opensrf-commits mailing list