Use double eval for alarms as recommended by DBI(3)

This commit is contained in:
Xavier 2019-09-03 06:31:58 +02:00
parent e05d948ac4
commit 36ee1b80c2
3 changed files with 23 additions and 13 deletions

View File

@ -93,6 +93,9 @@ logLevel = warn
[configuration]
; confTimeout: maximum time to get configuration (default 10)
;confTimeout = 5
; GLOBAL CONFIGURATION ACCESS TYPE
; (File, REST, SOAP, RDBI/CDBI, LDAP, YAMLFile)
; Set here the parameters needed to access to LemonLDAP::NG configuration.

View File

@ -403,9 +403,12 @@ sub _launch {
my $res;
eval {
local $SIG{ALRM} = sub { die "TIMEOUT\n" };
alarm ($self->{confTimeout} || 10);
$res = &{ $self->{type} . "::$sub" }( $self, @_ );
eval {
alarm( $self->{confTimeout} || 10 );
$res = &{ $self->{type} . "::$sub" }( $self, @_ );
};
alarm 0;
die $@ if $@;
};
$msg .= $@ if $@;
return $res;

View File

@ -166,19 +166,23 @@ sub _tie_session {
eval {
local $SIG{ALRM} = sub { die "TIMEOUT\n" };
alarm $self->timeout;
eval {
alarm $self->timeout;
# SOAP/REST session module must be directly tied
if ( $self->storageModule =~ /^Lemonldap::NG::Common::Apache::Session/ )
{
tie %h, $self->storageModule, $self->id,
{ %{ $self->options }, %$options, kind => $self->kind };
}
else {
tie %h, 'Lemonldap::NG::Common::Apache::Session', $self->id,
{ %{ $self->options }, %$options };
}
# SOAP/REST session module must be directly tied
if ( $self->storageModule =~
/^Lemonldap::NG::Common::Apache::Session/ )
{
tie %h, $self->storageModule, $self->id,
{ %{ $self->options }, %$options, kind => $self->kind };
}
else {
tie %h, 'Lemonldap::NG::Common::Apache::Session', $self->id,
{ %{ $self->options }, %$options };
}
};
alarm 0;
die $@ if $@;
};
if ( $@ or not tied(%h) ) {