Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
7507b29d
Commit
7507b29d
authored
Mar 07, 2015
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Give vcl.load and vcl.inline a third argument which can be
"auto", "cold" or "warm".
parent
c4102bcf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
10 deletions
+23
-10
mgt_vcc.c
bin/varnishd/mgt/mgt_vcc.c
+23
-10
No files found.
bin/varnishd/mgt/mgt_vcc.c
View file @
7507b29d
...
...
@@ -56,6 +56,7 @@ struct vclprog {
char
*
name
;
char
*
fname
;
int
active
;
char
state
[
8
];
};
struct
vcc_priv
{
...
...
@@ -86,7 +87,7 @@ static const char * const builtin_vcl =
/*--------------------------------------------------------------------*/
static
void
mgt_vcc_add
(
const
char
*
name
,
const
char
*
libfile
)
mgt_vcc_add
(
const
char
*
name
,
const
char
*
libfile
,
const
char
*
state
)
{
struct
vclprog
*
vp
;
...
...
@@ -94,6 +95,7 @@ mgt_vcc_add(const char *name, const char *libfile)
XXXAN
(
vp
);
REPLACE
(
vp
->
name
,
name
);
REPLACE
(
vp
->
fname
,
libfile
);
bprintf
(
vp
->
state
,
"%s"
,
state
);
if
(
VTAILQ_EMPTY
(
&
vclhead
))
vp
->
active
=
1
;
VTAILQ_INSERT_TAIL
(
&
vclhead
,
vp
,
list
);
...
...
@@ -338,7 +340,7 @@ mgt_vcc_compile(struct vcc_priv *vp, struct vsb *sb, int C_flag)
static
void
mgt_VccCompile
(
struct
cli
*
cli
,
const
char
*
vclname
,
const
char
*
vclsrc
,
int
C_flag
)
const
char
*
state
,
int
C_flag
)
{
struct
vcc_priv
vp
;
struct
vsb
*
sb
;
...
...
@@ -346,6 +348,17 @@ mgt_VccCompile(struct cli *cli, const char *vclname, const char *vclsrc,
char
*
p
;
AN
(
cli
);
if
(
state
==
NULL
)
state
=
"auto"
;
if
(
strcmp
(
state
,
"auto"
)
&&
strcmp
(
state
,
"cold"
)
&&
strcmp
(
state
,
"warm"
))
{
VCLI_Out
(
cli
,
"State must be one of auto, cold or warm."
);
VCLI_SetResult
(
cli
,
CLIS_PARAM
);
return
;
}
sb
=
VSB_new_auto
();
XXXAN
(
sb
);
...
...
@@ -387,14 +400,14 @@ mgt_VccCompile(struct cli *cli, const char *vclname, const char *vclsrc,
VCLI_Out
(
cli
,
"VCL compiled.
\n
"
);
if
(
child_pid
<
0
)
{
mgt_vcc_add
(
vclname
,
vp
.
libfile
);
mgt_vcc_add
(
vclname
,
vp
.
libfile
,
state
);
free
(
vp
.
libfile
);
return
;
}
if
(
!
mgt_cli_askchild
(
&
status
,
&
p
,
"vcl.load %s %s
\n
"
,
vclname
,
vp
.
libfil
e
))
{
mgt_vcc_add
(
vclname
,
vp
.
libfile
);
"vcl.load %s %s
%s
\n
"
,
vclname
,
vp
.
libfile
,
stat
e
))
{
mgt_vcc_add
(
vclname
,
vp
.
libfile
,
state
);
free
(
vp
.
libfile
);
free
(
p
);
return
;
...
...
@@ -417,7 +430,7 @@ mgt_vcc_default(struct cli *cli, const char *b_arg, const char *vclsrc,
if
(
b_arg
==
NULL
)
{
AN
(
vclsrc
);
mgt_VccCompile
(
cli
,
"boot"
,
vclsrc
,
C_flag
);
mgt_VccCompile
(
cli
,
"boot"
,
vclsrc
,
NULL
,
C_flag
);
return
;
}
...
...
@@ -427,7 +440,7 @@ mgt_vcc_default(struct cli *cli, const char *b_arg, const char *vclsrc,
"backend default {
\n
"
" .host =
\"
%s
\"
;
\n
"
"}
\n
"
,
b_arg
);
mgt_VccCompile
(
cli
,
"boot"
,
buf
,
C_flag
);
mgt_VccCompile
(
cli
,
"boot"
,
buf
,
NULL
,
C_flag
);
}
/*--------------------------------------------------------------------*/
...
...
@@ -439,7 +452,7 @@ mgt_push_vcls_and_start(unsigned *status, char **p)
VTAILQ_FOREACH
(
vp
,
&
vclhead
,
list
)
{
if
(
mgt_cli_askchild
(
status
,
p
,
"vcl.load
\"
%s
\"
%s
\n
"
,
vp
->
name
,
vp
->
fnam
e
))
"vcl.load
\"
%s
\"
%s
%s
\n
"
,
vp
->
name
,
vp
->
fname
,
vp
->
stat
e
))
return
(
1
);
free
(
*
p
);
if
(
!
vp
->
active
)
...
...
@@ -500,7 +513,7 @@ mcf_vcl_inline(struct cli *cli, const char * const *av, void *priv)
return
;
}
mgt_VccCompile
(
cli
,
av
[
2
],
av
[
3
],
0
);
mgt_VccCompile
(
cli
,
av
[
2
],
av
[
3
],
av
[
4
],
0
);
}
void
...
...
@@ -524,7 +537,7 @@ mcf_vcl_load(struct cli *cli, const char * const *av, void *priv)
return
;
}
mgt_VccCompile
(
cli
,
av
[
2
],
vcl
,
0
);
mgt_VccCompile
(
cli
,
av
[
2
],
vcl
,
av
[
4
],
0
);
free
(
vcl
);
}
...
...
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