Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
OpenLDAP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nadezhda Ivanova
OpenLDAP
Commits
c1501fd3
Commit
c1501fd3
authored
25 years ago
by
Kurt Zeilenga
Browse files
Options
Downloads
Patches
Plain Diff
Use difftime() to determine cache age.
parent
f90277ed
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libraries/libldap/cache.c
+7
-6
7 additions, 6 deletions
libraries/libldap/cache.c
libraries/libldap/ldap-int.h
+1
-1
1 addition, 1 deletion
libraries/libldap/ldap-int.h
with
8 additions
and
7 deletions
libraries/libldap/cache.c
+
7
−
6
View file @
c1501fd3
...
...
@@ -376,7 +376,7 @@ ldap_check_cache( LDAP *ld, unsigned long msgtype, BerElement *request )
LDAPMessage
*
m
,
*
new
,
*
prev
,
*
next
;
BerElement
reqber
;
int
first
,
hash
;
unsigned
long
valid
time
;
time_t
c_
time
;
Debug
(
LDAP_DEBUG_TRACE
,
"ldap_check_cache
\n
"
,
0
,
0
,
0
);
...
...
@@ -388,14 +388,14 @@ ldap_check_cache( LDAP *ld, unsigned long msgtype, BerElement *request )
reqber
.
ber_buf
=
reqber
.
ber_ptr
=
request
->
ber_buf
;
reqber
.
ber_end
=
request
->
ber_ptr
;
valid
time
=
(
long
)
time
(
NULL
)
-
ld
->
ld_cache
->
lc_timeout
;
c_
time
=
time
(
NULL
);
prev
=
NULLMSG
;
hash
=
cache_hash
(
&
reqber
);
for
(
m
=
ld
->
ld_cache
->
lc_buckets
[
hash
];
m
!=
NULLMSG
;
m
=
next
)
{
Debug
(
LDAP_DEBUG_TRACE
,
"cc: examining id %d,type %d
\n
"
,
m
->
lm_msgid
,
m
->
lm_msgtype
,
0
);
if
(
m
->
lm_time
<
valid
time
)
{
if
(
difftime
(
c_time
,
m
->
lm_time
)
>
ld
->
ld_cache
->
lc_
time
out
)
{
/* delete expired message */
next
=
m
->
lm_next
;
if
(
prev
==
NULL
)
{
...
...
@@ -617,7 +617,8 @@ check_cache_memused( LDAPCache *lc )
* } while ( cache size is > SIZE_FACTOR * lc_maxmem )
*/
int
i
;
unsigned
long
remove_threshold
,
validtime
;
unsigned
long
remove_threshold
;
time_t
c_time
;
LDAPMessage
*
m
,
*
prev
,
*
next
;
Debug
(
LDAP_DEBUG_TRACE
,
"check_cache_memused: %ld bytes in use (%ld max)
\n
"
,
...
...
@@ -630,13 +631,13 @@ check_cache_memused( LDAPCache *lc )
remove_threshold
=
lc
->
lc_timeout
;
while
(
lc
->
lc_memused
>
lc
->
lc_maxmem
*
SIZE_FACTOR
)
{
valid
time
=
(
long
)
time
(
NULL
)
-
remove_threshold
;
c_
time
=
time
(
NULL
);
for
(
i
=
0
;
i
<
LDAP_CACHE_BUCKETS
;
++
i
)
{
prev
=
NULLMSG
;
for
(
m
=
lc
->
lc_buckets
[
i
];
m
!=
NULLMSG
;
m
=
next
)
{
next
=
m
->
lm_next
;
if
(
m
->
lm_time
<
validtime
)
{
if
(
difftime
(
c_time
,
m
->
lm_time
)
>
remove_threshold
)
{
if
(
prev
==
NULLMSG
)
{
lc
->
lc_buckets
[
i
]
=
next
;
}
else
{
...
...
This diff is collapsed.
Click to expand it.
libraries/libldap/ldap-int.h
+
1
−
1
View file @
c1501fd3
...
...
@@ -73,7 +73,7 @@ struct ldapmsg {
BerElement
*
lm_ber
;
/* the ber encoded message contents */
struct
ldapmsg
*
lm_chain
;
/* for search - next msg in the resp */
struct
ldapmsg
*
lm_next
;
/* next response */
unsigned
in
t
lm_time
;
/* used to maintain cache */
time_
t
lm_time
;
/* used to maintain cache */
};
#define NULLMSG ((LDAPMessage *)NULL)
/*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment