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
ed411722
Commit
ed411722
authored
Dec 04, 2015
by
Dridi Boukelmoune
Committed by
Lasse Karstensen
Jan 13, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't create backends on cooling VCLs, return NULL
parent
6f3fdd21
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
5 deletions
+21
-5
cache_backend.h
bin/varnishd/cache/cache_backend.h
+1
-1
cache_backend_cfg.c
bin/varnishd/cache/cache_backend_cfg.c
+10
-2
cache_vcl.c
bin/varnishd/cache/cache_vcl.c
+7
-1
directors.rst
doc/sphinx/reference/directors.rst
+3
-1
No files found.
bin/varnishd/cache/cache_backend.h
View file @
ed411722
...
...
@@ -130,5 +130,5 @@ struct vbc *VBT_Get(struct tcp_pool *, double tmo, const struct backend *,
void
VBT_Wait
(
struct
worker
*
,
struct
vbc
*
);
/* cache_vcl.c */
void
VCL_AddBackend
(
struct
vcl
*
,
struct
backend
*
);
int
VCL_AddBackend
(
struct
vcl
*
,
struct
backend
*
);
void
VCL_DelBackend
(
struct
backend
*
);
bin/varnishd/cache/cache_backend_cfg.c
View file @
ed411722
...
...
@@ -65,10 +65,12 @@ struct director *
VRT_new_backend
(
VRT_CTX
,
const
struct
vrt_backend
*
vrt
)
{
struct
backend
*
b
;
struct
director
*
d
;
struct
vsb
*
vsb
;
struct
vcl
*
vcl
;
struct
tcp_pool
*
tp
=
NULL
;
const
struct
vrt_backend_probe
*
vbp
;
int
retval
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
vrt
,
VRT_BACKEND_MAGIC
);
...
...
@@ -123,9 +125,15 @@ VRT_new_backend(VRT_CTX, const struct vrt_backend *vrt)
if
(
vbp
!=
NULL
)
VBP_Insert
(
b
,
vbp
,
tp
);
VCL_AddBackend
(
ctx
->
vcl
,
b
);
retval
=
VCL_AddBackend
(
ctx
->
vcl
,
b
);
if
(
retval
==
0
)
return
(
b
->
director
);
return
(
b
->
director
);
d
=
b
->
director
;
VRT_delete_backend
(
ctx
,
&
d
);
AZ
(
d
);
return
(
NULL
);
}
/*--------------------------------------------------------------------
...
...
bin/varnishd/cache/cache_vcl.c
View file @
ed411722
...
...
@@ -193,12 +193,16 @@ VCL_Rel(struct vcl **vcc)
/*--------------------------------------------------------------------*/
void
int
VCL_AddBackend
(
struct
vcl
*
vcl
,
struct
backend
*
be
)
{
CHECK_OBJ_NOTNULL
(
vcl
,
VCL_MAGIC
);
CHECK_OBJ_NOTNULL
(
be
,
BACKEND_MAGIC
);
if
(
vcl
->
temp
==
vcl_temp_cooling
)
return
(
1
);
Lck_Lock
(
&
vcl_mtx
);
VTAILQ_INSERT_TAIL
(
&
vcl
->
backend_list
,
be
,
vcl_list
);
Lck_Unlock
(
&
vcl_mtx
);
...
...
@@ -208,6 +212,8 @@ VCL_AddBackend(struct vcl *vcl, struct backend *be)
VBE_Event
(
be
,
VCL_EVENT_WARM
);
}
else
if
(
vcl
->
temp
!=
vcl_temp_init
)
WRONG
(
"Dynamic Backends can only be added to warm VCLs"
);
return
(
0
);
}
void
...
...
doc/sphinx/reference/directors.rst
View file @
ed411722
...
...
@@ -110,7 +110,9 @@ Finally, Varnish will take care of event propagation for *all* native backends,
but dynamic backends can only be created when the VCL is warm. If your backends
are created by an independent thread (basically outside of VCL scope) you must
subscribe to VCL events and watch for VCL state (see
:ref:`ref-vmod-event-functions`). You are also encouraged to comply with the
:ref:`ref-vmod-event-functions`). Varnish will panic if you try to create a
backend on a cold VCL, and ``VRT_new_backend`` will return ``NULL`` if the VCL
is cooling. You are also encouraged to comply with the
:ref:`ref_vcl_temperature` in general.
...
...
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