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
860d7de5
Commit
860d7de5
authored
Apr 29, 2013
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Push the req->busyobj change all the way up through getfd.
parent
8b86482c
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
28 additions
and
27 deletions
+28
-27
cache.h
bin/varnishd/cache/cache.h
+1
-1
cache_backend.c
bin/varnishd/cache/cache_backend.c
+5
-5
cache_backend.h
bin/varnishd/cache/cache_backend.h
+1
-1
cache_dir.c
bin/varnishd/cache/cache_dir.c
+5
-5
cache_fetch.c
bin/varnishd/cache/cache_fetch.c
+1
-1
cache_pipe.c
bin/varnishd/cache/cache_pipe.c
+1
-1
fall_back.c
lib/libvmod_directors/fall_back.c
+3
-3
hash.c
lib/libvmod_directors/hash.c
+1
-1
random.c
lib/libvmod_directors/random.c
+3
-3
round_robin.c
lib/libvmod_directors/round_robin.c
+3
-3
vdir.c
lib/libvmod_directors/vdir.c
+3
-2
vdir.h
lib/libvmod_directors/vdir.h
+1
-1
No files found.
bin/varnishd/cache/cache.h
View file @
860d7de5
...
...
@@ -734,7 +734,7 @@ void VBE_UseHealth(const struct director *vdi);
void
VBE_DiscardHealth
(
const
struct
director
*
vdi
);
struct
vbc
*
VDI_GetFd
(
const
struct
director
*
,
struct
req
*
);
struct
vbc
*
VDI_GetFd
(
const
struct
director
*
,
struct
busyobj
*
);
int
VDI_Healthy
(
const
struct
director
*
,
const
uint8_t
*
digest
);
void
VDI_CloseFd
(
struct
vbc
**
vbp
);
void
VDI_RecycleFd
(
struct
vbc
**
vbp
);
...
...
bin/varnishd/cache/cache_backend.c
View file @
860d7de5
...
...
@@ -455,20 +455,20 @@ VBE_DiscardHealth(const struct director *vdi)
*/
static
struct
vbc
*
__match_proto__
(
vdi_getfd_f
)
vdi_simple_getfd
(
const
struct
director
*
d
,
struct
req
*
req
)
vdi_simple_getfd
(
const
struct
director
*
d
,
struct
busyobj
*
bo
)
{
struct
vdi_simple
*
vs
;
struct
vbc
*
vc
;
CHECK_OBJ_NOTNULL
(
req
,
REQ
_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ
_MAGIC
);
CHECK_OBJ_NOTNULL
(
d
,
DIRECTOR_MAGIC
);
CAST_OBJ_NOTNULL
(
vs
,
d
->
priv
,
VDI_SIMPLE_MAGIC
);
vc
=
vbe_GetVbe
(
req
->
busyobj
,
vs
);
vc
=
vbe_GetVbe
(
bo
,
vs
);
if
(
vc
!=
NULL
)
{
FIND_TMO
(
first_byte_timeout
,
vc
->
first_byte_timeout
,
req
->
busyobj
,
vs
->
vrt
);
vc
->
first_byte_timeout
,
bo
,
vs
->
vrt
);
FIND_TMO
(
between_bytes_timeout
,
vc
->
between_bytes_timeout
,
req
->
busyobj
,
vs
->
vrt
);
vc
->
between_bytes_timeout
,
bo
,
vs
->
vrt
);
}
return
(
vc
);
}
...
...
bin/varnishd/cache/cache_backend.h
View file @
860d7de5
...
...
@@ -75,7 +75,7 @@ struct vrt_backend_probe;
* backends to use.
*/
typedef
struct
vbc
*
vdi_getfd_f
(
const
struct
director
*
,
struct
req
*
);
typedef
struct
vbc
*
vdi_getfd_f
(
const
struct
director
*
,
struct
busyobj
*
);
typedef
void
vdi_fini_f
(
const
struct
director
*
);
typedef
unsigned
vdi_healthy
(
const
struct
director
*
,
const
uint8_t
*
digest
);
...
...
bin/varnishd/cache/cache_dir.c
View file @
860d7de5
...
...
@@ -101,17 +101,17 @@ VDI_RecycleFd(struct vbc **vbp)
/* Get a connection --------------------------------------------------*/
struct
vbc
*
VDI_GetFd
(
const
struct
director
*
d
,
struct
req
*
req
)
VDI_GetFd
(
const
struct
director
*
d
,
struct
busyobj
*
bo
)
{
struct
vbc
*
vc
;
CHECK_OBJ_NOTNULL
(
req
,
REQ
_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ
_MAGIC
);
if
(
d
==
NULL
)
d
=
req
->
director
;
d
=
bo
->
director
;
CHECK_OBJ_NOTNULL
(
d
,
DIRECTOR_MAGIC
);
vc
=
d
->
getfd
(
d
,
req
);
vc
=
d
->
getfd
(
d
,
bo
);
if
(
vc
!=
NULL
)
vc
->
vsl
=
req
->
busyobj
->
vsl
;
vc
->
vsl
=
bo
->
vsl
;
return
(
vc
);
}
...
...
bin/varnishd/cache/cache_fetch.c
View file @
860d7de5
...
...
@@ -383,7 +383,7 @@ FetchHdr(struct req *req, int need_host_hdr, int sendbody)
hp
=
bo
->
bereq
;
bo
->
vbc
=
VDI_GetFd
(
NULL
,
req
);
bo
->
vbc
=
VDI_GetFd
(
NULL
,
bo
);
if
(
bo
->
vbc
==
NULL
)
{
VSLb
(
req
->
vsl
,
SLT_FetchError
,
"no backend connection"
);
return
(
-
1
);
...
...
bin/varnishd/cache/cache_pipe.c
View file @
860d7de5
...
...
@@ -75,7 +75,7 @@ PipeRequest(struct req *req)
bo
=
req
->
busyobj
;
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
vc
=
VDI_GetFd
(
NULL
,
req
);
vc
=
VDI_GetFd
(
NULL
,
bo
);
if
(
vc
==
NULL
)
return
;
bo
->
vbc
=
vc
;
/* For panic dumping */
...
...
lib/libvmod_directors/fall_back.c
View file @
860d7de5
...
...
@@ -54,7 +54,7 @@ vmod_rr_healthy(const struct director *dir, const uint8_t *digest)
}
static
struct
vbc
*
__match_proto__
(
vdi_getfd_f
)
vmod_rr_getfd
(
const
struct
director
*
dir
,
struct
req
*
req
)
vmod_rr_getfd
(
const
struct
director
*
dir
,
struct
busyobj
*
bo
)
{
struct
vmod_directors_fallback
*
rr
;
unsigned
u
;
...
...
@@ -65,13 +65,13 @@ vmod_rr_getfd(const struct director *dir, struct req *req)
for
(
u
=
0
;
u
<
rr
->
vd
->
n_backend
;
u
++
)
{
be
=
rr
->
vd
->
backend
[
u
];
CHECK_OBJ_NOTNULL
(
be
,
DIRECTOR_MAGIC
);
if
(
be
->
healthy
(
be
,
req
->
digest
))
if
(
be
->
healthy
(
be
,
bo
->
digest
))
break
;
}
vdir_unlock
(
rr
->
vd
);
if
(
u
==
rr
->
vd
->
n_backend
||
be
==
NULL
)
return
(
NULL
);
return
(
be
->
getfd
(
be
,
req
));
return
(
be
->
getfd
(
be
,
bo
));
}
VCL_VOID
__match_proto__
()
...
...
lib/libvmod_directors/hash.c
View file @
860d7de5
...
...
@@ -118,6 +118,6 @@ vmod_hash_backend(struct req *req, struct vmod_directors_hash *rr, const char *a
r
=
vbe32dec
(
sha256
);
r
=
scalbn
(
r
,
-
32
);
be
=
vdir_pick_be
(
rr
->
vd
,
req
,
r
,
rr
->
nloops
);
be
=
vdir_pick_be
(
rr
->
vd
,
req
->
busyobj
,
r
,
rr
->
nloops
);
return
(
be
);
}
lib/libvmod_directors/random.c
View file @
860d7de5
...
...
@@ -59,7 +59,7 @@ vmod_rr_healthy(const struct director *dir, const uint8_t *digest)
}
static
struct
vbc
*
__match_proto__
(
vdi_getfd_f
)
vmod_rr_getfd
(
const
struct
director
*
dir
,
struct
req
*
req
)
vmod_rr_getfd
(
const
struct
director
*
dir
,
struct
busyobj
*
bo
)
{
struct
vmod_directors_random
*
rr
;
VCL_BACKEND
be
;
...
...
@@ -67,10 +67,10 @@ vmod_rr_getfd(const struct director *dir, struct req *req)
CAST_OBJ_NOTNULL
(
rr
,
dir
->
priv
,
VMOD_DIRECTORS_RANDOM_MAGIC
);
r
=
scalbn
(
random
(),
-
31
);
be
=
vdir_pick_be
(
rr
->
vd
,
req
,
r
,
rr
->
nloops
);
be
=
vdir_pick_be
(
rr
->
vd
,
bo
,
r
,
rr
->
nloops
);
if
(
be
==
NULL
)
return
(
NULL
);
return
(
be
->
getfd
(
be
,
req
));
return
(
be
->
getfd
(
be
,
bo
));
}
VCL_VOID
__match_proto__
()
...
...
lib/libvmod_directors/round_robin.c
View file @
860d7de5
...
...
@@ -55,7 +55,7 @@ vmod_rr_healthy(const struct director *dir, const uint8_t *digest)
}
static
struct
vbc
*
__match_proto__
(
vdi_getfd_f
)
vmod_rr_getfd
(
const
struct
director
*
dir
,
struct
req
*
req
)
vmod_rr_getfd
(
const
struct
director
*
dir
,
struct
busyobj
*
bo
)
{
struct
vmod_directors_round_robin
*
rr
;
unsigned
u
;
...
...
@@ -68,13 +68,13 @@ vmod_rr_getfd(const struct director *dir, struct req *req)
be
=
rr
->
vd
->
backend
[
rr
->
nxt
];
rr
->
nxt
++
;
CHECK_OBJ_NOTNULL
(
be
,
DIRECTOR_MAGIC
);
if
(
be
->
healthy
(
be
,
req
->
digest
))
if
(
be
->
healthy
(
be
,
bo
->
digest
))
break
;
}
vdir_unlock
(
rr
->
vd
);
if
(
u
==
rr
->
vd
->
n_backend
||
be
==
NULL
)
return
(
NULL
);
return
(
be
->
getfd
(
be
,
req
));
return
(
be
->
getfd
(
be
,
bo
));
}
VCL_VOID
__match_proto__
()
...
...
lib/libvmod_directors/vdir.c
View file @
860d7de5
...
...
@@ -169,7 +169,8 @@ vdir_pick_by_weight(const struct vdir *vd, double w,
}
VCL_BACKEND
vdir_pick_be
(
struct
vdir
*
vd
,
const
struct
req
*
req
,
double
w
,
unsigned
nloops
)
vdir_pick_be
(
struct
vdir
*
vd
,
const
struct
busyobj
*
bo
,
double
w
,
unsigned
nloops
)
{
struct
vbitmap
*
vbm
=
NULL
;
unsigned
u
,
v
,
l
;
...
...
@@ -185,7 +186,7 @@ vdir_pick_be(struct vdir *vd, const struct req *req, double w, unsigned nloops)
u
=
vdir_pick_by_weight
(
vd
,
w
*
tw
,
vbm
);
be
=
vd
->
backend
[
u
];
CHECK_OBJ_NOTNULL
(
be
,
DIRECTOR_MAGIC
);
if
(
be
->
healthy
(
be
,
req
->
digest
))
if
(
be
->
healthy
(
be
,
bo
->
digest
))
break
;
if
(
l
==
0
)
{
vbm
=
vd
->
vbm
;
...
...
lib/libvmod_directors/vdir.h
View file @
860d7de5
...
...
@@ -48,5 +48,5 @@ void vdir_lock(struct vdir *vd);
void
vdir_unlock
(
struct
vdir
*
vd
);
unsigned
vdir_add_backend
(
struct
vdir
*
vd
,
VCL_BACKEND
be
,
double
weight
);
unsigned
vdir_any_healthy
(
struct
vdir
*
vd
,
const
uint8_t
*
digest
);
VCL_BACKEND
vdir_pick_be
(
struct
vdir
*
vd
,
const
struct
req
*
req
,
double
w
,
VCL_BACKEND
vdir_pick_be
(
struct
vdir
*
vd
,
const
struct
busyobj
*
,
double
w
,
unsigned
nloops
);
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