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
8f85e380
Commit
8f85e380
authored
Jun 22, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move request vary string from wrk to sess
parent
b64281a7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
28 deletions
+39
-28
cache.h
bin/varnishd/cache.h
+6
-4
cache_center.c
bin/varnishd/cache_center.c
+24
-15
cache_vary.c
bin/varnishd/cache_vary.c
+9
-9
No files found.
bin/varnishd/cache.h
View file @
8f85e380
...
@@ -300,9 +300,6 @@ struct worker {
...
@@ -300,9 +300,6 @@ struct worker {
/* Lookup stuff */
/* Lookup stuff */
struct
SHA256Context
*
sha256ctx
;
struct
SHA256Context
*
sha256ctx
;
uint8_t
*
vary_b
;
uint8_t
*
vary_l
;
uint8_t
*
vary_e
;
struct
http_conn
htc
[
1
];
struct
http_conn
htc
[
1
];
struct
ws
ws
[
1
];
struct
ws
ws
[
1
];
...
@@ -554,6 +551,11 @@ struct sess {
...
@@ -554,6 +551,11 @@ struct sess {
unsigned
char
digest
[
DIGEST_LEN
];
unsigned
char
digest
[
DIGEST_LEN
];
/* Built Vary string */
uint8_t
*
vary_b
;
uint8_t
*
vary_l
;
uint8_t
*
vary_e
;
struct
http_conn
htc
[
1
];
struct
http_conn
htc
[
1
];
/* Timestamps, all on TIM_real() timescale */
/* Timestamps, all on TIM_real() timescale */
...
@@ -884,7 +886,7 @@ void RES_StreamPoll(const struct sess *sp);
...
@@ -884,7 +886,7 @@ void RES_StreamPoll(const struct sess *sp);
/* cache_vary.c */
/* cache_vary.c */
struct
vsb
*
VRY_Create
(
const
struct
sess
*
sp
,
const
struct
http
*
hp
);
struct
vsb
*
VRY_Create
(
const
struct
sess
*
sp
,
const
struct
http
*
hp
);
int
VRY_Match
(
const
struct
sess
*
sp
,
const
uint8_t
*
vary
);
int
VRY_Match
(
struct
sess
*
sp
,
const
uint8_t
*
vary
);
/* cache_vcl.c */
/* cache_vcl.c */
void
VCL_Init
(
void
);
void
VCL_Init
(
void
);
...
...
bin/varnishd/cache_center.c
View file @
8f85e380
...
@@ -1028,28 +1028,23 @@ cnt_lookup(struct sess *sp)
...
@@ -1028,28 +1028,23 @@ cnt_lookup(struct sess *sp)
struct
objcore
*
oc
;
struct
objcore
*
oc
;
struct
object
*
o
;
struct
object
*
o
;
struct
objhead
*
oh
;
struct
objhead
*
oh
;
struct
worker
*
wrk
;
CHECK_OBJ_NOTNULL
(
sp
,
SESS_MAGIC
);
CHECK_OBJ_NOTNULL
(
sp
,
SESS_MAGIC
);
CHECK_OBJ_NOTNULL
(
sp
->
vcl
,
VCL_CONF_MAGIC
);
CHECK_OBJ_NOTNULL
(
sp
->
vcl
,
VCL_CONF_MAGIC
);
if
(
sp
->
hash_objhead
==
NULL
)
{
wrk
=
sp
->
wrk
;
/* Not a waiting list return */
AZ
(
wrk
->
vary_b
);
AZ
(
sp
->
vary_b
);
AZ
(
wrk
->
vary_l
);
AZ
(
sp
->
vary_l
);
AZ
(
wrk
->
vary_e
);
AZ
(
sp
->
vary_e
);
(
void
)
WS_Reserve
(
wrk
->
ws
,
0
);
(
void
)
WS_Reserve
(
sp
->
ws
,
0
);
wrk
->
vary_b
=
(
void
*
)
wrk
->
ws
->
f
;
sp
->
vary_b
=
(
void
*
)
sp
->
ws
->
f
;
wrk
->
vary_e
=
(
void
*
)
wrk
->
ws
->
r
;
sp
->
vary_e
=
(
void
*
)
sp
->
ws
->
r
;
wrk
->
vary_b
[
2
]
=
'\0'
;
sp
->
vary_b
[
2
]
=
'\0'
;
}
oc
=
HSH_Lookup
(
sp
,
&
oh
);
oc
=
HSH_Lookup
(
sp
,
&
oh
);
WS_Release
(
wrk
->
ws
,
0
);
wrk
->
vary_b
=
NULL
;
wrk
->
vary_l
=
NULL
;
wrk
->
vary_e
=
NULL
;
if
(
oc
==
NULL
)
{
if
(
oc
==
NULL
)
{
/*
/*
* We lost the session to a busy object, disembark the
* We lost the session to a busy object, disembark the
...
@@ -1060,6 +1055,7 @@ cnt_lookup(struct sess *sp)
...
@@ -1060,6 +1055,7 @@ cnt_lookup(struct sess *sp)
return
(
1
);
return
(
1
);
}
}
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
CHECK_OBJ_NOTNULL
(
oh
,
OBJHEAD_MAGIC
);
CHECK_OBJ_NOTNULL
(
oh
,
OBJHEAD_MAGIC
);
...
@@ -1067,6 +1063,14 @@ cnt_lookup(struct sess *sp)
...
@@ -1067,6 +1063,14 @@ cnt_lookup(struct sess *sp)
if
(
oc
->
flags
&
OC_F_BUSY
)
{
if
(
oc
->
flags
&
OC_F_BUSY
)
{
sp
->
wrk
->
stats
.
cache_miss
++
;
sp
->
wrk
->
stats
.
cache_miss
++
;
if
(
sp
->
vary_l
!=
NULL
)
WS_ReleaseP
(
sp
->
ws
,
(
void
*
)
sp
->
vary_l
);
else
WS_Release
(
sp
->
ws
,
0
);
sp
->
vary_b
=
NULL
;
sp
->
vary_l
=
NULL
;
sp
->
vary_e
=
NULL
;
sp
->
objcore
=
oc
;
sp
->
objcore
=
oc
;
sp
->
step
=
STP_MISS
;
sp
->
step
=
STP_MISS
;
return
(
0
);
return
(
0
);
...
@@ -1076,6 +1080,11 @@ cnt_lookup(struct sess *sp)
...
@@ -1076,6 +1080,11 @@ cnt_lookup(struct sess *sp)
CHECK_OBJ_NOTNULL
(
o
,
OBJECT_MAGIC
);
CHECK_OBJ_NOTNULL
(
o
,
OBJECT_MAGIC
);
sp
->
obj
=
o
;
sp
->
obj
=
o
;
WS_Release
(
sp
->
ws
,
0
);
sp
->
vary_b
=
NULL
;
sp
->
vary_l
=
NULL
;
sp
->
vary_e
=
NULL
;
if
(
oc
->
flags
&
OC_F_PASS
)
{
if
(
oc
->
flags
&
OC_F_PASS
)
{
sp
->
wrk
->
stats
.
cache_hitpass
++
;
sp
->
wrk
->
stats
.
cache_hitpass
++
;
WSP
(
sp
,
SLT_HitPass
,
"%u"
,
sp
->
obj
->
xid
);
WSP
(
sp
,
SLT_HitPass
,
"%u"
,
sp
->
obj
->
xid
);
...
...
bin/varnishd/cache_vary.c
View file @
8f85e380
...
@@ -176,9 +176,9 @@ vry_cmp(const uint8_t * const *v1, uint8_t * const *v2)
...
@@ -176,9 +176,9 @@ vry_cmp(const uint8_t * const *v1, uint8_t * const *v2)
}
}
int
int
VRY_Match
(
const
struct
sess
*
sp
,
const
uint8_t
*
vary
)
VRY_Match
(
struct
sess
*
sp
,
const
uint8_t
*
vary
)
{
{
uint8_t
*
vsp
=
sp
->
wrk
->
vary_b
;
uint8_t
*
vsp
=
sp
->
vary_b
;
char
*
h
,
*
e
;
char
*
h
,
*
e
;
unsigned
lh
,
ln
;
unsigned
lh
,
ln
;
int
i
,
retval
=
1
,
oflo
=
0
;
int
i
,
retval
=
1
,
oflo
=
0
;
...
@@ -204,8 +204,8 @@ VRY_Match(const struct sess *sp, const uint8_t *vary)
...
@@ -204,8 +204,8 @@ VRY_Match(const struct sess *sp, const uint8_t *vary)
/* Length of the entire new vary entry */
/* Length of the entire new vary entry */
ln
=
2
+
vary
[
2
]
+
2
+
(
lh
==
0xffff
?
0
:
lh
);
ln
=
2
+
vary
[
2
]
+
2
+
(
lh
==
0xffff
?
0
:
lh
);
if
(
vsp
+
ln
>=
sp
->
wrk
->
vary_e
)
{
if
(
vsp
+
ln
>=
sp
->
vary_e
)
{
vsp
=
sp
->
wrk
->
vary_b
;
vsp
=
sp
->
vary_b
;
oflo
=
1
;
oflo
=
1
;
}
}
...
@@ -213,7 +213,7 @@ VRY_Match(const struct sess *sp, const uint8_t *vary)
...
@@ -213,7 +213,7 @@ VRY_Match(const struct sess *sp, const uint8_t *vary)
* We MUST have space for one entry and the end marker
* We MUST have space for one entry and the end marker
* after it, which prevents old junk from confusing us
* after it, which prevents old junk from confusing us
*/
*/
assert
(
vsp
+
ln
+
2
<
sp
->
wrk
->
vary_e
);
assert
(
vsp
+
ln
+
2
<
sp
->
vary_e
);
vbe16enc
(
vsp
,
(
uint16_t
)
lh
);
vbe16enc
(
vsp
,
(
uint16_t
)
lh
);
memcpy
(
vsp
+
2
,
vary
+
2
,
vary
[
2
]
+
2
);
memcpy
(
vsp
+
2
,
vary
+
2
,
vary
[
2
]
+
2
);
...
@@ -231,19 +231,19 @@ VRY_Match(const struct sess *sp, const uint8_t *vary)
...
@@ -231,19 +231,19 @@ VRY_Match(const struct sess *sp, const uint8_t *vary)
vsp
+=
vry_len
(
vsp
);
vsp
+=
vry_len
(
vsp
);
vary
+=
vry_len
(
vary
);
vary
+=
vry_len
(
vary
);
}
}
if
(
vsp
+
3
>
sp
->
wrk
->
vary_e
)
if
(
vsp
+
3
>
sp
->
vary_e
)
oflo
=
1
;
oflo
=
1
;
if
(
oflo
)
{
if
(
oflo
)
{
/* XXX: Should log this */
/* XXX: Should log this */
vsp
=
sp
->
wrk
->
vary_b
;
vsp
=
sp
->
vary_b
;
}
}
vsp
[
0
]
=
0xff
;
vsp
[
0
]
=
0xff
;
vsp
[
1
]
=
0xff
;
vsp
[
1
]
=
0xff
;
vsp
[
2
]
=
0
;
vsp
[
2
]
=
0
;
if
(
oflo
)
if
(
oflo
)
sp
->
wrk
->
vary_l
=
NULL
;
sp
->
vary_l
=
NULL
;
else
else
sp
->
wrk
->
vary_l
=
vsp
+
3
;
sp
->
vary_l
=
vsp
+
3
;
return
(
retval
);
return
(
retval
);
}
}
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