Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Icecast-Server
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
100
Issues
100
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
External Wiki
External Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xiph.Org
Icecast-Server
Commits
45d44a63
Commit
45d44a63
authored
Jul 06, 2018
by
Philipp Schafft
🦁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feature: Clear XSLT cache on config reload
parent
3ffe5f4e
Pipeline
#245
failed with stage
in 11 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
9 deletions
+27
-9
cfgfile.c
src/cfgfile.c
+2
-0
xslt.c
src/xslt.c
+24
-9
xslt.h
src/xslt.h
+1
-0
No files found.
src/cfgfile.c
View file @
45d44a63
...
...
@@ -44,6 +44,7 @@
#include "connection.h"
#include "main.h"
#include "slave.h"
#include "xslt.h"
#define CATMODULE "CONFIG"
#define CONFIG_DEFAULT_LOCATION "Earth"
...
...
@@ -748,6 +749,7 @@ void config_reread_config(void)
stats_global
(
config
);
config_release_config
();
slave_update_all_mounts
();
xslt_clear_cache
();
}
}
...
...
src/xslt.c
View file @
45d44a63
...
...
@@ -115,14 +115,8 @@ void xslt_initialize(void)
}
void
xslt_shutdown
(
void
)
{
int
i
;
for
(
i
=
0
;
i
<
CACHESIZE
;
i
++
)
{
if
(
cache
[
i
].
filename
)
free
(
cache
[
i
].
filename
);
if
(
cache
[
i
].
stylesheet
)
xsltFreeStylesheet
(
cache
[
i
].
stylesheet
);
}
xslt_clear_cache
();
thread_mutex_destroy
(
&
xsltlock
);
xmlCleanupParser
();
...
...
@@ -131,6 +125,26 @@ void xslt_shutdown(void) {
xmlFree
(
admin_path
);
}
static
void
clear_cache_entry
(
size_t
idx
)
{
free
(
cache
[
idx
].
filename
);
if
(
cache
[
idx
].
stylesheet
)
xsltFreeStylesheet
(
cache
[
idx
].
stylesheet
);
}
void
xslt_clear_cache
(
void
)
{
size_t
i
;
ICECAST_LOG_DEBUG
(
"Clearing stylesheet cache."
);
thread_mutex_lock
(
&
xsltlock
);
for
(
i
=
0
;
i
<
CACHESIZE
;
i
++
)
clear_cache_entry
(
i
);
thread_mutex_unlock
(
&
xsltlock
);
}
static
int
evict_cache_entry
(
void
)
{
int
i
,
age
=
0
,
oldest
=
0
;
...
...
@@ -141,8 +155,7 @@ static int evict_cache_entry(void) {
}
}
xsltFreeStylesheet
(
cache
[
oldest
].
stylesheet
);
free
(
cache
[
oldest
].
filename
);
clear_cache_entry
(
oldest
);
return
oldest
;
}
...
...
@@ -282,9 +295,11 @@ static xmlDocPtr custom_loader(const xmlChar *URI,
/* Get the actual xmlDoc */
if
(
final_URI
)
{
ICECAST_LOG_DEBUG
(
"Calling xslt_loader() for
\"
%s
\"
(was:
\"
%s
\"
)."
,
final_URI
,
URI
);
ret
=
xslt_loader
(
final_URI
,
dict
,
options
,
ctxt
,
type
);
xmlFree
(
final_URI
);
}
else
{
ICECAST_LOG_DEBUG
(
"Calling xslt_loader() for
\"
%s
\"
."
,
URI
);
ret
=
xslt_loader
(
URI
,
dict
,
options
,
ctxt
,
type
);
}
return
ret
;
...
...
src/xslt.h
View file @
45d44a63
...
...
@@ -19,4 +19,5 @@
void
xslt_transform
(
xmlDocPtr
doc
,
const
char
*
xslfilename
,
client_t
*
client
,
int
status
);
void
xslt_initialize
(
void
);
void
xslt_shutdown
(
void
);
void
xslt_clear_cache
(
void
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment