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
5eeabe7d
Commit
5eeabe7d
authored
Jul 16, 2014
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BAN_CheckObject() can pretty far with a struct objcore, so postpone
the object instantiation until needed.
parent
c55468d7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
18 deletions
+17
-18
cache.h
bin/varnishd/cache/cache.h
+1
-1
cache_ban.c
bin/varnishd/cache/cache_ban.c
+13
-15
cache_hash.c
bin/varnishd/cache/cache_hash.c
+3
-2
No files found.
bin/varnishd/cache/cache.h
View file @
5eeabe7d
...
...
@@ -776,7 +776,7 @@ void BAN_Init(void);
void
BAN_Shutdown
(
void
);
void
BAN_NewObjCore
(
struct
objcore
*
oc
);
void
BAN_DestroyObj
(
struct
objcore
*
oc
);
int
BAN_CheckObject
(
const
struct
object
*
o
,
struct
req
*
sp
);
int
BAN_CheckObject
(
struct
worker
*
,
struct
objcore
*
,
struct
req
*
);
void
BAN_Reload
(
const
uint8_t
*
ban
,
unsigned
len
);
struct
ban
*
BAN_TailRef
(
void
);
void
BAN_Compile
(
void
);
...
...
bin/varnishd/cache/cache_ban.c
View file @
5eeabe7d
...
...
@@ -899,19 +899,20 @@ ban_evaluate(const uint8_t *bs, const struct http *objhttp,
* 1 Ban matched, object removed from ban list.
*/
static
int
ban_check_object
(
const
struct
object
*
o
,
struct
vsl_log
*
vsl
,
const
struct
http
*
req_http
)
int
BAN_CheckObject
(
struct
worker
*
wrk
,
struct
objcore
*
oc
,
struct
req
*
req
)
{
struct
ban
*
b
;
struct
objcore
*
oc
;
struct
vsl_log
*
vsl
;
struct
object
*
o
;
struct
ban
*
volatile
b0
;
unsigned
tests
;
CHECK_OBJ_NOTNULL
(
o
,
OBJECT_MAGIC
);
CHECK_OBJ_NOTNULL
(
req_http
,
HTTP_MAGIC
);
oc
=
o
->
objcore
;
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
vsl
=
req
->
vsl
;
CHECK_OBJ_NOTNULL
(
oc
->
ban
,
BAN_MAGIC
);
/* First do an optimistic unlocked check */
...
...
@@ -929,6 +930,10 @@ ban_check_object(const struct object *o, struct vsl_log *vsl,
if
(
b0
==
oc
->
ban
)
return
(
0
);
/* Now we need the object */
o
=
ObjGetObj
(
oc
,
&
wrk
->
stats
);
CHECK_OBJ_NOTNULL
(
o
,
OBJECT_MAGIC
);
/*
* This loop is safe without locks, because we know we hold
* a refcount on a ban somewhere in the list and we do not
...
...
@@ -939,7 +944,7 @@ ban_check_object(const struct object *o, struct vsl_log *vsl,
CHECK_OBJ_NOTNULL
(
b
,
BAN_MAGIC
);
if
(
b
->
flags
&
BANS_FLAG_COMPLETED
)
continue
;
if
(
ban_evaluate
(
b
->
spec
,
o
->
http
,
req
_
http
,
&
tests
))
if
(
ban_evaluate
(
b
->
spec
,
o
->
http
,
req
->
http
,
&
tests
))
break
;
}
...
...
@@ -969,13 +974,6 @@ ban_check_object(const struct object *o, struct vsl_log *vsl,
}
}
int
BAN_CheckObject
(
const
struct
object
*
o
,
struct
req
*
req
)
{
return
(
ban_check_object
(
o
,
req
->
vsl
,
req
->
http
)
>
0
);
}
static
void
ban_cleantail
(
void
)
{
...
...
bin/varnishd/cache/cache_hash.c
View file @
5eeabe7d
...
...
@@ -423,11 +423,12 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp,
if
(
oc
->
exp
.
ttl
<=
0
.)
continue
;
if
(
BAN_CheckObject
(
wrk
,
oc
,
req
))
continue
;
o
=
ObjGetObj
(
oc
,
&
wrk
->
stats
);
CHECK_OBJ_NOTNULL
(
o
,
OBJECT_MAGIC
);
if
(
BAN_CheckObject
(
o
,
req
))
continue
;
if
(
o
->
vary
!=
NULL
&&
!
VRY_Match
(
req
,
o
->
vary
))
continue
;
...
...
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