Lines 688-701
C<$auth> whether this connection has rw access (1) or just r access (0 or NULL)
Link Here
|
688 |
=cut |
688 |
=cut |
689 |
|
689 |
|
690 |
sub Zconn { |
690 |
sub Zconn { |
691 |
my $self=shift; |
691 |
my ($self, $server, $async, $auth, $piggyback, $syntax) = @_; |
692 |
my $server=shift; |
692 |
|
693 |
my $async=shift; |
693 |
my $cache_key = join ('::', (map { $_ // '' } ($server, $async, $auth, $piggyback, $syntax))); |
694 |
my $auth=shift; |
694 |
if ( defined($context->{"Zconn"}->{$cache_key}) && (0 == $context->{"Zconn"}->{$cache_key}->errcode()) ) { |
695 |
my $piggyback=shift; |
695 |
return $context->{"Zconn"}->{$cache_key}; |
696 |
my $syntax=shift; |
|
|
697 |
if ( defined($context->{"Zconn"}->{$server}) && (0 == $context->{"Zconn"}->{$server}->errcode()) ) { |
698 |
return $context->{"Zconn"}->{$server}; |
699 |
# No connection object or it died. Create one. |
696 |
# No connection object or it died. Create one. |
700 |
}else { |
697 |
}else { |
701 |
# release resources if we're closing a connection and making a new one |
698 |
# release resources if we're closing a connection and making a new one |
Lines 704-713
sub Zconn {
Link Here
|
704 |
# and make a new one, particularly for a batch job. However, at |
701 |
# and make a new one, particularly for a batch job. However, at |
705 |
# first glance it does not look like there's a way to easily check |
702 |
# first glance it does not look like there's a way to easily check |
706 |
# the basic health of a ZOOM::Connection |
703 |
# the basic health of a ZOOM::Connection |
707 |
$context->{"Zconn"}->{$server}->destroy() if defined($context->{"Zconn"}->{$server}); |
704 |
$context->{"Zconn"}->{$cache_key}->destroy() if defined($context->{"Zconn"}->{$cache_key}); |
708 |
|
705 |
|
709 |
$context->{"Zconn"}->{$server} = &_new_Zconn($server,$async,$auth,$piggyback,$syntax); |
706 |
$context->{"Zconn"}->{$cache_key} = &_new_Zconn($server,$async,$auth,$piggyback,$syntax); |
710 |
return $context->{"Zconn"}->{$server}; |
707 |
return $context->{"Zconn"}->{$cache_key}; |
711 |
} |
708 |
} |
712 |
} |
709 |
} |
713 |
|
710 |
|
714 |
- |
|
|