Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvdfp-pipe
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvdfp-pipe
Commits
cc352245
Commit
cc352245
authored
Aug 04, 2020
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add an event function, cleans up VDPs and RB tree entries.
parent
c75f8919
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
3 deletions
+53
-3
vdp.vtc
src/tests/vdp.vtc
+6
-0
vdfp_pipe.c
src/vdfp_pipe.c
+45
-3
vdfp_pipe.vcc
src/vdfp_pipe.vcc
+2
-0
No files found.
src/tests/vdp.vtc
View file @
cc352245
...
...
@@ -68,3 +68,9 @@ logexpect l1 -v v1 -g vxid -d 1 -q {Error ~ "^vdfp_pipe: vdp f:" or Notice ~ "^v
expect * = Error {^vdfp_pipe: vdp f: /bin/false exited with status \d+$}
expect * = End
} -run
varnish v1 -vcl { backend b None; }
# Tests the discard event, with removal of VDPs.
varnish v1 -cli "vcl.discard vcl1"
varnish v1 -cli "vcl.list"
src/vdfp_pipe.c
View file @
cc352245
...
...
@@ -457,6 +457,50 @@ vdp_fini(struct req *req, void **priv)
return
(
0
);
}
/* Event function */
int
vmod_event
(
VRT_CTX
,
struct
vmod_priv
*
priv
,
enum
vcl_event_e
e
)
{
struct
vdp_map
*
map
,
*
prev_map
;
ASSERT_CLI
();
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
AN
(
priv
);
switch
(
e
)
{
case
VCL_EVENT_DISCARD
:
AN
(
ctx
->
vcl
);
map
=
VRBT_MIN
(
vdp_tree
,
&
tree_h
);
while
(
map
!=
NULL
)
{
CHECK_OBJ
(
map
,
PIPE_VDP_MAP_MAGIC
);
prev_map
=
NULL
;
if
(
map
->
vcl_name
!=
NULL
&&
strcmp
(
map
->
vcl_name
,
VCL_Name
(
ctx
->
vcl
))
==
0
)
{
CHECK_OBJ_NOTNULL
(
map
->
obj
,
PIPE_VDP_MAGIC
);
if
(
map
->
obj
->
vdp
!=
NULL
)
{
VRT_RemoveVDP
(
ctx
,
map
->
obj
->
vdp
);
free
(
map
->
obj
->
vdp
);
}
prev_map
=
map
;
}
map
=
VRBT_NEXT
(
vdp_tree
,
&
tree_h
,
map
);
if
(
prev_map
!=
NULL
)
{
VRBT_REMOVE
(
vdp_tree
,
&
tree_h
,
map
);
FREE_OBJ
(
map
);
}
}
return
(
0
);
case
VCL_EVENT_LOAD
:
case
VCL_EVENT_WARM
:
case
VCL_EVENT_COLD
:
return
(
0
);
default:
WRONG
(
"illegal event enum"
);
}
NEEDLESS
(
return
(
0
));
}
/* vdp object */
VCL_VOID
...
...
@@ -545,15 +589,13 @@ vmod_vdp__init(VRT_CTX, struct VPFX(pipe_vdp) **vdpp, const char *obj_name,
return
;
}
/*
XXX
Event function calls VRT_RemoveVDP(), since it needs a VRT_CTX. */
/* Event function calls VRT_RemoveVDP(), since it needs a VRT_CTX. */
VCL_VOID
vmod_vdp__fini
(
struct
VPFX
(
pipe_vdp
)
**
vdpp
)
{
struct
VPFX
(
pipe_vdp
)
*
vdp_obj
;
/* XXX cleanup RB tree entry */
if
(
vdpp
==
NULL
||
*
vdpp
==
NULL
)
return
;
TAKE_OBJ_NOTNULL
(
vdp_obj
,
vdpp
,
PIPE_VDP_MAGIC
);
...
...
src/vdfp_pipe.vcc
View file @
cc352245
...
...
@@ -89,3 +89,5 @@ SEE ALSO
* Varnish: http://www.varnish-cache.org/
* varnishd(1): http://varnish-cache.org/docs/trunk/reference/varnishd.html
* vcl(7): http://varnish-cache.org/docs/trunk/reference/vcl.html
$Event event
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