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
c4c444ca
Commit
c4c444ca
authored
Sep 07, 2016
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a workspace for vcl events
parent
e8f41715
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
4 deletions
+34
-4
cache_vcl.c
bin/varnishd/cache/cache_vcl.c
+34
-4
No files found.
bin/varnishd/cache/cache_vcl.c
View file @
c4c444ca
...
...
@@ -514,9 +514,31 @@ VRT_rel_vcl(VRT_CTX, struct vclref **refp)
/*--------------------------------------------------------------------*/
static
struct
ws
*
vcl_event_ws
(
void
)
{
static
struct
ws
*
ws
=
NULL
;
static
char
*
ws_snap
;
ASSERT_CLI
();
if
(
ws
==
NULL
)
{
ws
=
malloc
(
sizeof
(
*
ws
));
AN
(
ws
);
WS_Init
(
ws
,
"cli"
,
malloc
(
cache_param
->
workspace_client
),
cache_param
->
workspace_client
);
ws_snap
=
WS_Snapshot
(
ws
);
}
else
{
WS_Reset
(
ws
,
ws_snap
);
WS_Assert
(
ws
);
}
return
(
ws
);
}
static
int
vcl_setup_event
(
VRT_CTX
,
enum
vcl_event_e
ev
)
vcl_setup_event
(
struct
vrt_ctx
*
ctx
,
enum
vcl_event_e
ev
)
{
int
r
;
ASSERT_CLI
();
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
...
...
@@ -526,12 +548,16 @@ vcl_setup_event(VRT_CTX, enum vcl_event_e ev)
AN
(
ctx
->
vcl
);
AN
(
ctx
->
msg
);
assert
(
ev
==
VCL_EVENT_LOAD
||
ev
==
VCL_EVENT_WARM
);
AZ
(
ctx
->
ws
);
ctx
->
ws
=
vcl_event_ws
();
r
=
ctx
->
vcl
->
conf
->
event_vcl
(
ctx
,
ev
);
ctx
->
ws
=
NULL
;
return
(
ctx
->
vcl
->
conf
->
event_vcl
(
ctx
,
ev
)
);
return
(
r
);
}
static
void
vcl_failsafe_event
(
VRT_CTX
,
enum
vcl_event_e
ev
)
vcl_failsafe_event
(
struct
vrt_ctx
*
ctx
,
enum
vcl_event_e
ev
)
{
ASSERT_CLI
();
...
...
@@ -541,9 +567,13 @@ vcl_failsafe_event(VRT_CTX, enum vcl_event_e ev)
AN
(
ctx
->
handling
);
AN
(
ctx
->
vcl
);
assert
(
ev
==
VCL_EVENT_COLD
||
ev
==
VCL_EVENT_DISCARD
);
AZ
(
ctx
->
ws
);
ctx
->
ws
=
vcl_event_ws
();
if
(
ctx
->
vcl
->
conf
->
event_vcl
(
ctx
,
ev
)
!=
0
)
WRONG
(
"A VMOD cannot fail COLD or DISCARD events"
);
ctx
->
ws
=
NULL
;
}
static
void
...
...
@@ -564,7 +594,7 @@ vcl_print_refs(VRT_CTX)
}
static
int
vcl_set_state
(
VRT_CTX
,
const
char
*
state
)
vcl_set_state
(
struct
vrt_ctx
*
ctx
,
const
char
*
state
)
{
struct
vcl
*
vcl
;
int
i
=
0
;
...
...
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