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
21c215fa
Commit
21c215fa
authored
Feb 02, 2017
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always initialize ctx->handling to zero, and try to avoid setting
it more than once.
parent
7347e93a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
5 deletions
+9
-5
cache_vcl.c
bin/varnishd/cache/cache_vcl.c
+5
-2
cache_vrt.c
bin/varnishd/cache/cache_vrt.c
+2
-0
b00014.vtc
bin/varnishtest/tests/b00014.vtc
+0
-1
vcc_compile.c
lib/libvcc/vcc_compile.c
+2
-2
No files found.
bin/varnishd/cache/cache_vcl.c
View file @
21c215fa
...
@@ -107,6 +107,7 @@ vcl_get_ctx(unsigned method, int msg)
...
@@ -107,6 +107,7 @@ vcl_get_ctx(unsigned method, int msg)
{
{
AZ
(
ctx_cli
.
handling
);
AZ
(
ctx_cli
.
handling
);
INIT_OBJ
(
&
ctx_cli
,
VRT_CTX_MAGIC
);
INIT_OBJ
(
&
ctx_cli
,
VRT_CTX_MAGIC
);
handling_cli
=
0
;
ctx_cli
.
handling
=
&
handling_cli
;
ctx_cli
.
handling
=
&
handling_cli
;
ctx_cli
.
method
=
method
;
ctx_cli
.
method
=
method
;
if
(
msg
)
{
if
(
msg
)
{
...
@@ -148,6 +149,7 @@ vcl_send_event(VRT_CTX, enum vcl_event_e ev)
...
@@ -148,6 +149,7 @@ vcl_send_event(VRT_CTX, enum vcl_event_e ev)
ev
==
VCL_EVENT_COLD
||
ev
==
VCL_EVENT_COLD
||
ev
==
VCL_EVENT_DISCARD
);
ev
==
VCL_EVENT_DISCARD
);
AN
(
ctx
->
handling
);
AN
(
ctx
->
handling
);
*
ctx
->
handling
=
0
;
AN
(
ctx
->
ws
);
AN
(
ctx
->
ws
);
if
(
ev
==
VCL_EVENT_LOAD
||
ev
==
VCL_EVENT_WARM
)
if
(
ev
==
VCL_EVENT_LOAD
||
ev
==
VCL_EVENT_WARM
)
...
@@ -713,6 +715,7 @@ vcl_cancel_load(VRT_CTX, struct cli *cli, const char *name, const char *step)
...
@@ -713,6 +715,7 @@ vcl_cancel_load(VRT_CTX, struct cli *cli, const char *name, const char *step)
VCLI_Out
(
cli
,
"VCL
\"
%s
\"
Failed %s"
,
name
,
step
);
VCLI_Out
(
cli
,
"VCL
\"
%s
\"
Failed %s"
,
name
,
step
);
if
(
VSB_len
(
ctx
->
msg
))
if
(
VSB_len
(
ctx
->
msg
))
VCLI_Out
(
cli
,
"
\n
Message:
\n\t
%s"
,
VSB_data
(
ctx
->
msg
));
VCLI_Out
(
cli
,
"
\n
Message:
\n\t
%s"
,
VSB_data
(
ctx
->
msg
));
*
ctx
->
handling
=
0
;
AZ
(
vcl
->
conf
->
event_vcl
(
ctx
,
VCL_EVENT_DISCARD
));
AZ
(
vcl
->
conf
->
event_vcl
(
ctx
,
VCL_EVENT_DISCARD
));
vcl_KillBackends
(
vcl
);
vcl_KillBackends
(
vcl
);
VCL_Close
(
&
vcl
);
VCL_Close
(
&
vcl
);
...
@@ -753,6 +756,7 @@ vcl_load(struct cli *cli, struct vrt_ctx *ctx,
...
@@ -753,6 +756,7 @@ vcl_load(struct cli *cli, struct vrt_ctx *ctx,
vcl_cancel_load
(
ctx
,
cli
,
name
,
"initialization"
);
vcl_cancel_load
(
ctx
,
cli
,
name
,
"initialization"
);
return
;
return
;
}
}
assert
(
*
ctx
->
handling
==
VCL_RET_OK
);
VSB_clear
(
ctx
->
msg
);
VSB_clear
(
ctx
->
msg
);
i
=
vcl_set_state
(
ctx
,
state
);
i
=
vcl_set_state
(
ctx
,
state
);
if
(
i
)
{
if
(
i
)
{
...
@@ -761,7 +765,6 @@ vcl_load(struct cli *cli, struct vrt_ctx *ctx,
...
@@ -761,7 +765,6 @@ vcl_load(struct cli *cli, struct vrt_ctx *ctx,
return
;
return
;
}
}
bprintf
(
vcl
->
state
,
"%s"
,
state
+
1
);
bprintf
(
vcl
->
state
,
"%s"
,
state
+
1
);
assert
(
*
ctx
->
handling
==
VCL_RET_OK
);
VCLI_Out
(
cli
,
"Loaded
\"
%s
\"
as
\"
%s
\"
"
,
fn
,
name
);
VCLI_Out
(
cli
,
"Loaded
\"
%s
\"
as
\"
%s
\"
"
,
fn
,
name
);
VTAILQ_INSERT_TAIL
(
&
vcl_head
,
vcl
,
list
);
VTAILQ_INSERT_TAIL
(
&
vcl_head
,
vcl
,
list
);
Lck_Lock
(
&
vcl_mtx
);
Lck_Lock
(
&
vcl_mtx
);
...
@@ -1041,9 +1044,9 @@ vcl_call_method(struct worker *wrk, struct req *req, struct busyobj *bo,
...
@@ -1041,9 +1044,9 @@ vcl_call_method(struct worker *wrk, struct req *req, struct busyobj *bo,
ctx
.
vsl
=
vsl
;
ctx
.
vsl
=
vsl
;
ctx
.
specific
=
specific
;
ctx
.
specific
=
specific
;
ctx
.
method
=
method
;
ctx
.
method
=
method
;
wrk
->
handling
=
0
;
ctx
.
handling
=
&
wrk
->
handling
;
ctx
.
handling
=
&
wrk
->
handling
;
aws
=
WS_Snapshot
(
wrk
->
aws
);
aws
=
WS_Snapshot
(
wrk
->
aws
);
wrk
->
handling
=
0
;
wrk
->
cur_method
=
method
;
wrk
->
cur_method
=
method
;
wrk
->
seen_methods
|=
method
;
wrk
->
seen_methods
|=
method
;
AN
(
vsl
);
AN
(
vsl
);
...
...
bin/varnishd/cache/cache_vrt.c
View file @
21c215fa
...
@@ -252,7 +252,9 @@ VRT_handling(VRT_CTX, unsigned hand)
...
@@ -252,7 +252,9 @@ VRT_handling(VRT_CTX, unsigned hand)
{
{
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
assert
(
hand
>
0
);
assert
(
hand
<
VCL_RET_MAX
);
assert
(
hand
<
VCL_RET_MAX
);
// XXX:NOTYET assert(*ctx->handling == 0);
*
ctx
->
handling
=
hand
;
*
ctx
->
handling
=
hand
;
}
}
...
...
bin/varnishtest/tests/b00014.vtc
View file @
21c215fa
varnishtest "Check -f command line arg"
varnishtest "Check -f command line arg"
server s1 {
server s1 {
rxreq
rxreq
expect req.url == "/foo"
expect req.url == "/foo"
...
...
lib/libvcc/vcc_compile.c
View file @
21c215fa
...
@@ -311,6 +311,8 @@ EmitInitFini(const struct vcc *tl)
...
@@ -311,6 +311,8 @@ EmitInitFini(const struct vcc *tl)
}
}
Fc
(
tl
,
0
,
"
\t
(void)VGC_function_vcl_init(ctx);
\n
"
);
Fc
(
tl
,
0
,
"
\t
(void)VGC_function_vcl_init(ctx);
\n
"
);
Fc
(
tl
,
0
,
"
\t
if (*ctx->handling == 0)
\n
"
);
Fc
(
tl
,
0
,
"
\t\t
VRT_handling(ctx, VCL_RET_OK);
\n
"
);
Fc
(
tl
,
0
,
"
\t
return (*ctx->handling == VCL_RET_OK ? 0: -1);
\n
"
);
Fc
(
tl
,
0
,
"
\t
return (*ctx->handling == VCL_RET_OK ? 0: -1);
\n
"
);
Fc
(
tl
,
0
,
"}
\n
"
);
Fc
(
tl
,
0
,
"}
\n
"
);
...
@@ -655,8 +657,6 @@ vcc_CompileSource(struct vcc *tl, struct source *sp)
...
@@ -655,8 +657,6 @@ vcc_CompileSource(struct vcc *tl, struct source *sp)
* in members called from vcl_init, so set OK up front
* in members called from vcl_init, so set OK up front
* and return with whatever was set last.
* and return with whatever was set last.
*/
*/
if
(
method_tab
[
i
].
bitval
==
VCL_MET_INIT
)
Fc
(
tl
,
1
,
" VRT_handling(ctx, VCL_RET_OK);
\n
"
);
Fc
(
tl
,
1
,
"%s"
,
VSB_data
(
tl
->
fm
[
i
]));
Fc
(
tl
,
1
,
"%s"
,
VSB_data
(
tl
->
fm
[
i
]));
if
(
method_tab
[
i
].
bitval
==
VCL_MET_INIT
)
if
(
method_tab
[
i
].
bitval
==
VCL_MET_INIT
)
Fc
(
tl
,
1
,
" return (1);
\n
"
);
Fc
(
tl
,
1
,
" return (1);
\n
"
);
...
...
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