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
6d4447ce
Commit
6d4447ce
authored
Sep 10, 2016
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for PRIV_TASK in CLI induced VCL events.
See also: #2061
parent
2679527a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
7 deletions
+20
-7
cache_vcl.c
bin/varnishd/cache/cache_vcl.c
+1
-0
cache_vrt_priv.c
bin/varnishd/cache/cache_vrt_priv.c
+19
-7
No files found.
bin/varnishd/cache/cache_vcl.c
View file @
6d4447ce
...
...
@@ -127,6 +127,7 @@ vcl_rel_ctx(struct vrt_ctx **ctx)
WS_Reset
(
&
ws_cli
,
ws_snapshot_cli
);
INIT_OBJ
(
*
ctx
,
VRT_CTX_MAGIC
);
*
ctx
=
NULL
;
VRTPRIV_dynamic_kill
(
NULL
,
0
);
}
/*--------------------------------------------------------------------*/
...
...
bin/varnishd/cache/cache_vrt_priv.c
View file @
6d4447ce
...
...
@@ -48,23 +48,27 @@ struct vrt_priv {
uintptr_t
vmod_id
;
};
struct
vmod_priv
cli_task_priv
;
/*--------------------------------------------------------------------
*/
void
VRTPRIV_init
(
struct
vrt_privs
*
privs
)
{
privs
->
magic
=
VRT_PRIVS_MAGIC
;
INIT_OBJ
(
privs
,
VRT_PRIVS_MAGIC
);
VTAILQ_INIT
(
&
privs
->
privs
);
}
static
struct
vmod_priv
*
VRT
_priv_dynamic
(
VRT_CTX
,
uintptr_t
id
,
uintptr_t
vmod_id
)
vrt
_priv_dynamic
(
VRT_CTX
,
uintptr_t
id
,
uintptr_t
vmod_id
)
{
struct
vrt_privs
*
vps
;
struct
vrt_priv
*
vp
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
AN
(
vmod_id
);
if
(
ctx
->
req
)
{
CHECK_OBJ_NOTNULL
(
ctx
->
req
,
REQ_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
->
req
->
sp
,
SESS_MAGIC
);
...
...
@@ -94,7 +98,13 @@ VRTPRIV_dynamic_kill(struct vrt_privs *privs, uintptr_t id)
{
struct
vrt_priv
*
vp
,
*
vp1
;
if
(
privs
==
NULL
&&
id
==
0
)
{
ASSERT_CLI
();
VRT_priv_fini
(
&
cli_task_priv
);
return
;
}
CHECK_OBJ_NOTNULL
(
privs
,
VRT_PRIVS_MAGIC
);
AN
(
id
);
VTAILQ_FOREACH_SAFE
(
vp
,
&
privs
->
privs
,
list
,
vp1
)
{
CHECK_OBJ_NOTNULL
(
vp
,
VRT_PRIV_MAGIC
);
...
...
@@ -118,9 +128,11 @@ VRT_priv_task(VRT_CTX, void *vmod_id)
}
else
if
(
ctx
->
bo
)
{
CHECK_OBJ_NOTNULL
(
ctx
->
bo
,
BUSYOBJ_MAGIC
);
id
=
(
uintptr_t
)
ctx
->
bo
;
}
else
WRONG
(
"PRIV_TASK is only accessible in client or backend VCL contexts"
);
return
(
VRT_priv_dynamic
(
ctx
,
id
,
(
uintptr_t
)
vmod_id
));
}
else
{
ASSERT_CLI
();
return
(
&
cli_task_priv
);
}
return
(
vrt_priv_dynamic
(
ctx
,
id
,
(
uintptr_t
)
vmod_id
));
}
struct
vmod_priv
*
...
...
@@ -133,7 +145,7 @@ VRT_priv_top(VRT_CTX, void *vmod_id)
CHECK_OBJ_NOTNULL
(
ctx
->
req
,
REQ_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
->
req
->
top
,
REQ_MAGIC
);
id
=
(
uintptr_t
)
&
ctx
->
req
->
top
->
top
;
return
(
VRT
_priv_dynamic
(
ctx
,
id
,
(
uintptr_t
)
vmod_id
));
return
(
vrt
_priv_dynamic
(
ctx
,
id
,
(
uintptr_t
)
vmod_id
));
}
else
WRONG
(
"PRIV_TOP is only accessible in client VCL context"
);
NEEDLESS_RETURN
(
NULL
);
...
...
@@ -146,6 +158,6 @@ void
VRT_priv_fini
(
const
struct
vmod_priv
*
p
)
{
if
(
p
->
priv
!=
(
void
*
)
0
&&
p
->
free
!=
(
void
*
)
0
)
if
(
p
->
priv
!=
NULL
&&
p
->
free
!=
NULL
)
p
->
free
(
p
->
priv
);
}
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