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
016531bb
Commit
016531bb
authored
Sep 23, 2014
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shuffling the backend code around a bit in preparation for multi-protocol
backends.
parent
97014d35
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
54 additions
and
22 deletions
+54
-22
cache.h
bin/varnishd/cache/cache.h
+1
-0
cache_backend.c
bin/varnishd/cache/cache_backend.c
+43
-1
cache_backend.h
bin/varnishd/cache/cache_backend.h
+5
-2
cache_fetch.c
bin/varnishd/cache/cache_fetch.c
+2
-11
cache_http1_fetch.c
bin/varnishd/cache/cache_http1_fetch.c
+1
-6
vdir.c
lib/libvmod_directors/vdir.c
+1
-1
vdir.h
lib/libvmod_directors/vdir.h
+1
-1
No files found.
bin/varnishd/cache/cache.h
View file @
016531bb
...
...
@@ -695,6 +695,7 @@ void VBE_UseHealth(const struct director *vdi);
void
VBE_DiscardHealth
(
const
struct
director
*
vdi
);
int
VDI_GetHdr
(
struct
worker
*
wrk
,
struct
busyobj
*
bo
);
struct
vbc
*
VDI_GetFd
(
struct
busyobj
*
);
int
VDI_Healthy
(
const
struct
director
*
);
void
VDI_CloseFd
(
struct
vbc
**
vbp
,
const
struct
acct_bereq
*
);
...
...
bin/varnishd/cache/cache_backend.c
View file @
016531bb
...
...
@@ -42,6 +42,7 @@
#include "cache_backend.h"
#include "vrt.h"
#include "vtcp.h"
#include "vtim.h"
static
struct
mempool
*
vbcpool
;
...
...
@@ -355,6 +356,35 @@ VBE_DiscardHealth(const struct director *vdi)
VBP_Remove
(
vs
->
backend
,
vs
->
vrt
->
probe
);
}
/*--------------------------------------------------------------------
*/
int
VDI_GetHdr
(
struct
worker
*
wrk
,
struct
busyobj
*
bo
)
{
int
i
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
if
(
bo
->
director
==
NULL
)
{
VSLb
(
bo
->
vsl
,
SLT_FetchError
,
"No backend"
);
return
(
-
1
);
}
i
=
V1F_fetch_hdr
(
wrk
,
bo
);
/*
* If we recycle a backend connection, there is a finite chance
* that the backend closed it before we get a request to it.
* Do a single retry in that case.
*/
if
(
i
==
1
)
{
VSC_C_main
->
backend_retry
++
;
i
=
VDI_GetHdr
(
wrk
,
bo
);
}
return
(
i
);
}
/*--------------------------------------------------------------------
*
*/
...
...
@@ -378,7 +408,7 @@ vdi_simple_getfd(const struct director *d, struct busyobj *bo)
return
(
vc
);
}
static
unsigned
static
unsigned
__match_proto__
(
vdi_healthy_f
)
vdi_simple_healthy
(
const
struct
director
*
d
,
double
*
changed
)
{
struct
vdi_simple
*
vs
;
...
...
@@ -391,6 +421,17 @@ vdi_simple_healthy(const struct director *d, double *changed)
return
(
VBE_Healthy
(
be
,
changed
));
}
static
int
__match_proto__
(
vdi_gethdrs_f
)
vdi_simple_gethdrs
(
const
struct
director
*
d
,
struct
worker
*
wrk
,
struct
busyobj
*
bo
)
{
CHECK_OBJ_NOTNULL
(
d
,
DIRECTOR_MAGIC
);
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
return
(
-
1
);
}
/*--------------------------------------------------------------------*/
void
...
...
@@ -428,6 +469,7 @@ VRT_init_dir(struct cli *cli, struct director **bp, int idx, const void *priv)
REPLACE
(
vs
->
dir
.
vcl_name
,
t
->
vcl_name
);
vs
->
dir
.
getfd
=
vdi_simple_getfd
;
vs
->
dir
.
healthy
=
vdi_simple_healthy
;
vs
->
dir
.
gethdrs
=
vdi_simple_gethdrs
;
vs
->
vrt
=
t
;
...
...
bin/varnishd/cache/cache_backend.h
View file @
016531bb
...
...
@@ -76,7 +76,9 @@ struct vrt_backend_probe;
*/
typedef
struct
vbc
*
vdi_getfd_f
(
const
struct
director
*
,
struct
busyobj
*
);
typedef
unsigned
vdi_healthy
(
const
struct
director
*
,
double
*
changed
);
typedef
unsigned
vdi_healthy_f
(
const
struct
director
*
,
double
*
changed
);
typedef
int
vdi_gethdrs_f
(
const
struct
director
*
,
struct
worker
*
,
struct
busyobj
*
);
struct
director
{
unsigned
magic
;
...
...
@@ -84,7 +86,8 @@ struct director {
const
char
*
name
;
char
*
vcl_name
;
vdi_getfd_f
*
getfd
;
vdi_healthy
*
healthy
;
vdi_healthy_f
*
healthy
;
vdi_gethdrs_f
*
gethdrs
;
void
*
priv
;
};
...
...
bin/varnishd/cache/cache_fetch.c
View file @
016531bb
...
...
@@ -265,17 +265,8 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
assert
(
bo
->
state
<=
BOS_REQ_DONE
);
i
=
V1F_fetch_hdr
(
wrk
,
bo
);
/*
* If we recycle a backend connection, there is a finite chance
* that the backend closed it before we get a request to it.
* Do a single retry in that case.
*/
if
(
i
==
1
)
{
VSLb_ts_busyobj
(
bo
,
"Beresp"
,
W_TIM_real
(
wrk
));
VSC_C_main
->
backend_retry
++
;
i
=
V1F_fetch_hdr
(
wrk
,
bo
);
}
i
=
VDI_GetHdr
(
wrk
,
bo
);
now
=
W_TIM_real
(
wrk
);
VSLb_ts_busyobj
(
bo
,
"Beresp"
,
now
);
...
...
bin/varnishd/cache/cache_http1_fetch.c
View file @
016531bb
...
...
@@ -86,15 +86,10 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo)
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
->
director
,
DIRECTOR_MAGIC
);
CHECK_OBJ_ORNULL
(
bo
->
req
,
REQ_MAGIC
);
htc
=
bo
->
htc
;
if
(
bo
->
director
==
NULL
)
{
VSLb
(
bo
->
vsl
,
SLT_FetchError
,
"No backend"
);
return
(
-
1
);
}
AN
(
bo
->
director
);
hp
=
bo
->
bereq
;
bo
->
vbc
=
VDI_GetFd
(
bo
);
...
...
lib/libvmod_directors/vdir.c
View file @
016531bb
...
...
@@ -51,7 +51,7 @@ vdir_expand(struct vdir *vd, unsigned n)
}
void
vdir_new
(
struct
vdir
**
vdp
,
const
char
*
vcl_name
,
vdi_healthy
*
healthy
,
vdir_new
(
struct
vdir
**
vdp
,
const
char
*
vcl_name
,
vdi_healthy
_f
*
healthy
,
vdi_getfd_f
*
getfd
,
void
*
priv
)
{
struct
vdir
*
vd
;
...
...
lib/libvmod_directors/vdir.h
View file @
016531bb
...
...
@@ -41,7 +41,7 @@ struct vdir {
struct
vbitmap
*
vbm
;
};
void
vdir_new
(
struct
vdir
**
vdp
,
const
char
*
vcl_name
,
vdi_healthy
*
healthy
,
void
vdir_new
(
struct
vdir
**
vdp
,
const
char
*
vcl_name
,
vdi_healthy
_f
*
healthy
,
vdi_getfd_f
*
getfd
,
void
*
priv
);
void
vdir_delete
(
struct
vdir
**
vdp
);
void
vdir_lock
(
struct
vdir
*
vd
);
...
...
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