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
be938d34
Commit
be938d34
authored
Aug 11, 2014
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wrap obj->len in an accessor function
parent
4d5a73ba
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
28 deletions
+29
-28
cache.h
bin/varnishd/cache/cache.h
+1
-0
cache_esi_deliver.c
bin/varnishd/cache/cache_esi_deliver.c
+5
-3
cache_fetch.c
bin/varnishd/cache/cache_fetch.c
+9
-22
cache_http1_deliver.c
bin/varnishd/cache/cache_http1_deliver.c
+4
-3
cache_obj.c
bin/varnishd/cache/cache_obj.c
+10
-0
No files found.
bin/varnishd/cache/cache.h
View file @
be938d34
...
@@ -1059,6 +1059,7 @@ enum objiter_status ObjIter(struct objiter *, void **, ssize_t *);
...
@@ -1059,6 +1059,7 @@ enum objiter_status ObjIter(struct objiter *, void **, ssize_t *);
void
ObjIterEnd
(
struct
objiter
**
);
void
ObjIterEnd
(
struct
objiter
**
);
void
ObjTrimStore
(
struct
objcore
*
,
struct
dstat
*
);
void
ObjTrimStore
(
struct
objcore
*
,
struct
dstat
*
);
unsigned
ObjGetXID
(
struct
objcore
*
,
struct
dstat
*
);
unsigned
ObjGetXID
(
struct
objcore
*
,
struct
dstat
*
);
uint64_t
ObjGetLen
(
struct
objcore
*
oc
,
struct
dstat
*
ds
);
struct
object
*
ObjGetObj
(
struct
objcore
*
,
struct
dstat
*
);
struct
object
*
ObjGetObj
(
struct
objcore
*
,
struct
dstat
*
);
void
ObjUpdateMeta
(
struct
objcore
*
);
void
ObjUpdateMeta
(
struct
objcore
*
);
void
ObjFreeObj
(
struct
objcore
*
,
struct
dstat
*
);
void
ObjFreeObj
(
struct
objcore
*
,
struct
dstat
*
);
...
...
bin/varnishd/cache/cache_esi_deliver.c
View file @
be938d34
...
@@ -505,6 +505,7 @@ ESI_DeliverChild(struct req *req)
...
@@ -505,6 +505,7 @@ ESI_DeliverChild(struct req *req)
u_char
cc
;
u_char
cc
;
uint32_t
icrc
;
uint32_t
icrc
;
uint32_t
ilen
;
uint32_t
ilen
;
uint64_t
olen
;
uint8_t
*
dbits
;
uint8_t
*
dbits
;
int
i
,
j
;
int
i
,
j
;
uint8_t
tailbuf
[
8
];
uint8_t
tailbuf
[
8
];
...
@@ -534,9 +535,10 @@ ESI_DeliverChild(struct req *req)
...
@@ -534,9 +535,10 @@ ESI_DeliverChild(struct req *req)
start
=
vbe64dec
(
p
);
start
=
vbe64dec
(
p
);
last
=
vbe64dec
(
p
+
8
);
last
=
vbe64dec
(
p
+
8
);
stop
=
vbe64dec
(
p
+
16
);
stop
=
vbe64dec
(
p
+
16
);
assert
(
start
>
0
&&
start
<
obj
->
len
*
8
);
olen
=
ObjGetLen
(
obj
->
objcore
,
&
req
->
wrk
->
stats
);
assert
(
last
>
0
&&
last
<
obj
->
len
*
8
);
assert
(
start
>
0
&&
start
<
olen
*
8
);
assert
(
stop
>
0
&&
stop
<
obj
->
len
*
8
);
assert
(
last
>
0
&&
last
<
olen
*
8
);
assert
(
stop
>
0
&&
stop
<
olen
*
8
);
assert
(
last
>=
start
);
assert
(
last
>=
start
);
assert
(
last
<
stop
);
assert
(
last
<
stop
);
...
...
bin/varnishd/cache/cache_fetch.c
View file @
be938d34
...
@@ -559,6 +559,7 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
...
@@ -559,6 +559,7 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
struct
objiter
*
oi
;
struct
objiter
*
oi
;
void
*
sp
;
void
*
sp
;
ssize_t
sl
,
al
,
tl
;
ssize_t
sl
,
al
,
tl
;
uint64_t
ol
;
struct
storage
*
st
;
struct
storage
*
st
;
enum
objiter_status
ois
;
enum
objiter_status
ois
;
char
*
p
;
char
*
p
;
...
@@ -606,13 +607,13 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
...
@@ -606,13 +607,13 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
st
=
NULL
;
st
=
NULL
;
al
=
0
;
al
=
0
;
ol
=
ObjGetLen
(
bo
->
ims_oc
,
bo
->
stats
);
oi
=
ObjIterBegin
(
wrk
,
bo
->
ims_obj
);
oi
=
ObjIterBegin
(
wrk
,
bo
->
ims_obj
);
do
{
do
{
ois
=
ObjIter
(
oi
,
&
sp
,
&
sl
);
ois
=
ObjIter
(
oi
,
&
sp
,
&
sl
);
while
(
sl
>
0
)
{
while
(
sl
>
0
)
{
if
(
st
==
NULL
)
if
(
st
==
NULL
)
st
=
VFP_GetStorage
(
bo
->
vfc
,
st
=
VFP_GetStorage
(
bo
->
vfc
,
ol
-
al
);
bo
->
ims_obj
->
len
-
al
);
if
(
st
==
NULL
)
if
(
st
==
NULL
)
break
;
break
;
tl
=
sl
;
tl
=
sl
;
...
@@ -634,8 +635,8 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
...
@@ -634,8 +635,8 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
if
(
!
bo
->
do_stream
)
if
(
!
bo
->
do_stream
)
HSH_Unbusy
(
&
wrk
->
stats
,
obj
->
objcore
);
HSH_Unbusy
(
&
wrk
->
stats
,
obj
->
objcore
);
assert
(
al
==
bo
->
ims_obj
->
len
);
assert
(
al
==
ol
);
assert
(
obj
->
len
==
al
);
assert
(
ObjGetLen
(
bo
->
fetch_objcore
,
bo
->
stats
)
==
al
);
EXP_Rearm
(
bo
->
ims_oc
,
bo
->
ims_oc
->
exp
.
t_origin
,
0
,
0
,
0
);
EXP_Rearm
(
bo
->
ims_oc
,
bo
->
ims_oc
->
exp
.
t_origin
,
0
,
0
,
0
);
/* Recycle the backend connection before setting BOS_FINISHED to
/* Recycle the backend connection before setting BOS_FINISHED to
...
@@ -802,8 +803,6 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
...
@@ -802,8 +803,6 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
}
}
assert
(
WRW_IsReleased
(
wrk
));
assert
(
WRW_IsReleased
(
wrk
));
bo
->
stats
=
NULL
;
if
(
bo
->
vbc
!=
NULL
)
{
if
(
bo
->
vbc
!=
NULL
)
{
if
(
bo
->
doclose
!=
SC_NULL
)
if
(
bo
->
doclose
!=
SC_NULL
)
VDI_CloseFd
(
&
bo
->
vbc
,
&
bo
->
acct
);
VDI_CloseFd
(
&
bo
->
vbc
,
&
bo
->
acct
);
...
@@ -818,22 +817,8 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
...
@@ -818,22 +817,8 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
if
(
bo
->
state
==
BOS_FINISHED
)
{
if
(
bo
->
state
==
BOS_FINISHED
)
{
AZ
(
bo
->
fetch_objcore
->
flags
&
OC_F_FAILED
);
AZ
(
bo
->
fetch_objcore
->
flags
&
OC_F_FAILED
);
HSH_Complete
(
bo
->
fetch_objcore
);
HSH_Complete
(
bo
->
fetch_objcore
);
VSLb
(
bo
->
vsl
,
SLT_Length
,
"%zd"
,
bo
->
fetch_obj
->
len
);
VSLb
(
bo
->
vsl
,
SLT_Length
,
"%zd"
,
{
ObjGetLen
(
bo
->
fetch_objcore
,
bo
->
stats
));
/* Sanity check fetch methods accounting */
ssize_t
uu
;
struct
storage
*
st
;
uu
=
0
;
VTAILQ_FOREACH
(
st
,
&
bo
->
fetch_obj
->
body
->
list
,
list
)
uu
+=
st
->
len
;
if
(
bo
->
do_stream
)
/* Streaming might have started freeing stuff */
assert
(
uu
<=
bo
->
fetch_obj
->
len
);
else
assert
(
uu
==
bo
->
fetch_obj
->
len
);
}
}
}
AZ
(
bo
->
fetch_objcore
->
busyobj
);
AZ
(
bo
->
fetch_objcore
->
busyobj
);
...
@@ -842,6 +827,8 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
...
@@ -842,6 +827,8 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
bo
->
ims_obj
=
NULL
;
bo
->
ims_obj
=
NULL
;
}
}
bo
->
stats
=
NULL
;
VBO_DerefBusyObj
(
wrk
,
&
bo
);
VBO_DerefBusyObj
(
wrk
,
&
bo
);
THR_SetBusyobj
(
NULL
);
THR_SetBusyobj
(
NULL
);
}
}
...
...
bin/varnishd/cache/cache_http1_deliver.c
View file @
be938d34
...
@@ -99,7 +99,7 @@ v1d_dorange(struct req *req, struct busyobj *bo, const char *r)
...
@@ -99,7 +99,7 @@ v1d_dorange(struct req *req, struct busyobj *bo, const char *r)
if
(
bo
!=
NULL
)
if
(
bo
!=
NULL
)
len
=
VBO_waitlen
(
bo
,
-
1
);
len
=
VBO_waitlen
(
bo
,
-
1
);
else
else
len
=
req
->
obj
->
len
;
len
=
ObjGetLen
(
req
->
objcore
,
&
req
->
wrk
->
stats
)
;
if
(
strncmp
(
r
,
"bytes="
,
6
))
if
(
strncmp
(
r
,
"bytes="
,
6
))
return
;
return
;
...
@@ -252,10 +252,11 @@ V1D_Deliver(struct req *req, struct busyobj *bo)
...
@@ -252,10 +252,11 @@ V1D_Deliver(struct req *req, struct busyobj *bo)
/* XXX: Not happy with this convoluted test */
/* XXX: Not happy with this convoluted test */
req
->
res_mode
|=
RES_LEN
;
req
->
res_mode
|=
RES_LEN
;
if
(
!
(
req
->
objcore
->
flags
&
OC_F_PASS
)
||
if
(
!
(
req
->
objcore
->
flags
&
OC_F_PASS
)
||
req
->
obj
->
len
!=
0
)
{
ObjGetLen
(
req
->
objcore
,
&
req
->
wrk
->
stats
)
!=
0
)
{
http_Unset
(
req
->
resp
,
H_Content_Length
);
http_Unset
(
req
->
resp
,
H_Content_Length
);
http_PrintfHeader
(
req
->
resp
,
http_PrintfHeader
(
req
->
resp
,
"Content-Length: %zd"
,
req
->
obj
->
len
);
"Content-Length: %ju"
,
(
uintmax_t
)
ObjGetLen
(
req
->
objcore
,
&
req
->
wrk
->
stats
));
}
}
}
}
...
...
bin/varnishd/cache/cache_obj.c
View file @
be938d34
...
@@ -303,6 +303,16 @@ ObjGetXID(struct objcore *oc, struct dstat *ds)
...
@@ -303,6 +303,16 @@ ObjGetXID(struct objcore *oc, struct dstat *ds)
return
(
u
);
return
(
u
);
}
}
uint64_t
ObjGetLen
(
struct
objcore
*
oc
,
struct
dstat
*
ds
)
{
struct
object
*
o
;
o
=
ObjGetObj
(
oc
,
ds
);
CHECK_OBJ_NOTNULL
(
o
,
OBJECT_MAGIC
);
return
(
o
->
len
);
}
/*--------------------------------------------------------------------
/*--------------------------------------------------------------------
* There is no well-defined byteorder for IEEE-754 double and the
* There is no well-defined byteorder for IEEE-754 double and the
* correct solution (frexp(3) and manual encoding) is more work
* correct solution (frexp(3) and manual encoding) is more work
...
...
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