Bugzilla – Attachment 26507 Details for
Bug 11701
Fix C4::Context::Zconn
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11701: Fix C4::Context::Zconn
Bug-11701-Fix-C4ContextZconn.patch (text/plain), 2.81 KB, created by
Jonathan Druart
on 2014-03-21 09:49:16 UTC
(
hide
)
Description:
Bug 11701: Fix C4::Context::Zconn
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-03-21 09:49:16 UTC
Size:
2.81 KB
patch
obsolete
>From 53648007dc56a06d765740ff51023f73c0a640b3 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Wed, 13 Nov 2013 14:21:40 +0100 >Subject: [PATCH] Bug 11701: Fix C4::Context::Zconn > >When calling C4::Context::Zconn twice with different parameters, >the same ZOOM::Connection object is returned twice (parameters >of 2nd call are not used) This patch fixes that. > >This is in part, because the connection cache is keyed on server >name only. This patch corrects this by keying on all parameters. > >TEST PLAN >--------- >1) apply patch >2) run koha qa test tools >3) prove -v t/Context.t > >The unit tests properly triggers the modified routine for >testing. Additionally, in hunting for ways it could break, >no nested synchronous or asynchronous Zconn's were found. >And even if they were, the keying on all parameters should allow >it to function properly without messing up the other connection. > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >--- > C4/Context.pm | 19 ++++++++----------- > 1 file changed, 8 insertions(+), 11 deletions(-) > >diff --git a/C4/Context.pm b/C4/Context.pm >index 5a76137..71a0f8c 100644 >--- a/C4/Context.pm >+++ b/C4/Context.pm >@@ -688,14 +688,11 @@ C<$auth> whether this connection has rw access (1) or just r access (0 or NULL) > =cut > > sub Zconn { >- my $self=shift; >- my $server=shift; >- my $async=shift; >- my $auth=shift; >- my $piggyback=shift; >- my $syntax=shift; >- if ( defined($context->{"Zconn"}->{$server}) && (0 == $context->{"Zconn"}->{$server}->errcode()) ) { >- return $context->{"Zconn"}->{$server}; >+ my ($self, $server, $async, $auth, $piggyback, $syntax) = @_; >+ >+ my $cache_key = join ('::', (map { $_ // '' } ($server, $async, $auth, $piggyback, $syntax))); >+ if ( defined($context->{"Zconn"}->{$cache_key}) && (0 == $context->{"Zconn"}->{$cache_key}->errcode()) ) { >+ return $context->{"Zconn"}->{$cache_key}; > # No connection object or it died. Create one. > }else { > # release resources if we're closing a connection and making a new one >@@ -704,10 +701,10 @@ sub Zconn { > # and make a new one, particularly for a batch job. However, at > # first glance it does not look like there's a way to easily check > # the basic health of a ZOOM::Connection >- $context->{"Zconn"}->{$server}->destroy() if defined($context->{"Zconn"}->{$server}); >+ $context->{"Zconn"}->{$cache_key}->destroy() if defined($context->{"Zconn"}->{$cache_key}); > >- $context->{"Zconn"}->{$server} = &_new_Zconn($server,$async,$auth,$piggyback,$syntax); >- return $context->{"Zconn"}->{$server}; >+ $context->{"Zconn"}->{$cache_key} = &_new_Zconn($server,$async,$auth,$piggyback,$syntax); >+ return $context->{"Zconn"}->{$cache_key}; > } > } > >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11701
:
25101
|
25102
|
25439
|
26328
|
26329
|
26361
|
26362
|
26506
| 26507