Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
3788f25e
Commit
3788f25e
authored
21 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
added a library-wide interface for doing dns cache pruning, and no longer
make the pruning at each name lookup, only in Curl_done().
parent
5b885210
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/hostip.c
+17
-6
17 additions, 6 deletions
lib/hostip.c
lib/hostip.h
+3
-0
3 additions, 0 deletions
lib/hostip.h
lib/url.c
+2
-0
2 additions, 0 deletions
lib/url.c
with
22 additions
and
6 deletions
lib/hostip.c
+
17
−
6
View file @
3788f25e
...
...
@@ -195,6 +195,23 @@ hostcache_prune(curl_hash *hostcache, int cache_timeout, int now)
hostcache_timestamp_remove
);
}
void
Curl_hostcache_prune
(
struct
SessionHandle
*
data
)
{
time_t
now
;
if
(
data
->
share
)
Curl_share_lock
(
data
,
CURL_LOCK_DATA_DNS
,
CURL_LOCK_ACCESS_SINGLE
);
time
(
&
now
);
/* Remove outdated and unused entries from the hostcache */
hostcache_prune
(
data
->
hostcache
,
data
->
set
.
dns_cache_timeout
,
now
);
if
(
data
->
share
)
Curl_share_unlock
(
data
,
CURL_LOCK_DATA_DNS
);
}
#ifdef HAVE_SIGSETJMP
/* Beware this is a global and unique instance */
sigjmp_buf
curl_jmpenv
;
...
...
@@ -249,12 +266,6 @@ cache_resolv_response(struct SessionHandle *data,
dns
->
timestamp
=
now
;
/* used now */
dns
->
inuse
++
;
/* mark entry as in-use */
/* Remove outdated and unused entries from the hostcache */
hostcache_prune
(
data
->
hostcache
,
data
->
set
.
dns_cache_timeout
,
now
);
/* free the allocated entry_id again */
free
(
entry_id
);
...
...
This diff is collapsed.
Click to expand it.
lib/hostip.h
+
3
−
0
View file @
3788f25e
...
...
@@ -77,6 +77,9 @@ void Curl_freeaddrinfo(Curl_addrinfo *freeaddr);
/* free cached name info */
void
Curl_freednsinfo
(
void
*
freethis
);
/* prune old entries from the DNS cache */
void
Curl_hostcache_prune
(
struct
SessionHandle
*
data
);
#ifdef CURLDEBUG
void
curl_freeaddrinfo
(
struct
addrinfo
*
freethis
,
int
line
,
const
char
*
source
);
...
...
This diff is collapsed.
Click to expand it.
lib/url.c
+
2
−
0
View file @
3788f25e
...
...
@@ -3227,6 +3227,8 @@ CURLcode Curl_done(struct connectdata *conn)
NULL
,
Curl_scan_cache_used
);
#endif
Curl_hostcache_prune
(
data
);
/* kill old DNS cache entries */
/* this calls the protocol-specific function pointer previously set */
if
(
conn
->
curl_done
)
result
=
conn
->
curl_done
(
conn
);
...
...
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