Commit bbf86847 authored by Clément OUDOT's avatar Clément OUDOT
parent 898b52ab
......@@ -51,6 +51,7 @@ sub populate {
$self->{object_store} =
Lemonldap::NG::Common::Apache::Session::Store->new($self);
}
# If cache is configured, use our specific lock_manager object module
if ( $self->{args}->{localStorage} ) {
$self->{args}->{lock_manager} = $self->{lock_manager};
......
......@@ -5,9 +5,8 @@ use strict;
my $VERSION = '1.4.1';
sub new {
my $class = shift;
my $class = shift;
my $session = shift;
my $self = {};
......@@ -16,7 +15,6 @@ sub new {
return $self;
}
sub module {
my $self = shift;
return $self->{args}->{lock_manager};
......@@ -34,18 +32,18 @@ sub cache {
return $self->{cache};
}
sub acquire_read_lock {
sub acquire_read_lock {
my $self = shift;
my $session = shift;
# Get session from cache
my $id = $session->{data}->{_session_id};
if ( $self->cache->get($id) ) {
# got session from cache, no need to ask for locks
if ( $self->cache->get($id) ) {
# got session from cache, no need to ask for locks
}
else {
$self->module->acquire_read_lock($session);
$self->module->acquire_read_lock($session);
}
}
......@@ -63,20 +61,20 @@ sub release_write_lock {
$self->module->release_write_lock($session);
}
sub release_all_locks {
sub release_all_locks {
my $self = shift;
my $session = shift;
# Get session from cache
my $id = $session->{data}->{_session_id};
if ( $self->cache->get($id) ) {
# got session from cache, no need to ask for locks
if ( $self->cache->get($id) ) {
# got session from cache, no need to ask for locks
}
else {
$self->module->release_all_locks($session);
$self->module->release_all_locks($session);
}
}
1;
......@@ -66,13 +66,15 @@ sub lmUnsetHeaderIn {
if ( MP() == 2 ) {
$h = lc $h;
$h =~ s/-/_/g;
$r->headers_in->do( sub {
my $h1 = shift;
my $h2 = lc $h1;
$h2 =~ s/-/_/g;
$r->headers_in->unset($h1) if ( $h eq $h2 );
return 1;
} );
$r->headers_in->do(
sub {
my $h1 = shift;
my $h2 = lc $h1;
$h2 =~ s/-/_/g;
$r->headers_in->unset($h1) if ( $h eq $h2 );
return 1;
}
);
}
elsif ( MP() == 1 ) {
$r->header_in( $h => "" )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment