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
3999568c
Commit
3999568c
authored
Oct 24, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shave some session from FetchBody
parent
8c80f864
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
24 deletions
+24
-24
cache.h
bin/varnishd/cache.h
+1
-1
cache_center.c
bin/varnishd/cache_center.c
+2
-2
cache_fetch.c
bin/varnishd/cache_fetch.c
+21
-21
No files found.
bin/varnishd/cache.h
View file @
3999568c
...
...
@@ -702,7 +702,7 @@ int EXP_NukeOne(struct worker *w, struct lru *lru);
/* cache_fetch.c */
struct
storage
*
FetchStorage
(
const
struct
sess
*
sp
,
ssize_t
sz
);
int
FetchHdr
(
struct
sess
*
sp
);
int
FetchBody
(
struct
sess
*
sp
);
int
FetchBody
(
struct
sess
*
sp
,
struct
object
*
obj
);
int
FetchReqBody
(
struct
sess
*
sp
);
void
Fetch_Init
(
void
);
...
...
bin/varnishd/cache_center.c
View file @
3999568c
...
...
@@ -846,7 +846,7 @@ cnt_fetchbody(struct sess *sp)
}
/* Use unmodified headers*/
i
=
FetchBody
(
sp
);
i
=
FetchBody
(
sp
,
sp
->
obj
);
sp
->
wrk
->
h_content_length
=
NULL
;
...
...
@@ -910,7 +910,7 @@ cnt_streambody(struct sess *sp)
AssertObjCorePassOrBusy
(
sp
->
obj
->
objcore
);
i
=
FetchBody
(
sp
);
i
=
FetchBody
(
sp
,
sp
->
obj
);
sp
->
wrk
->
h_content_length
=
NULL
;
...
...
bin/varnishd/cache_fetch.c
View file @
3999568c
...
...
@@ -477,7 +477,7 @@ FetchHdr(struct sess *sp)
/*--------------------------------------------------------------------*/
int
FetchBody
(
struct
sess
*
sp
)
FetchBody
(
struct
sess
*
sp
,
struct
object
*
obj
)
{
int
cls
;
struct
storage
*
st
;
...
...
@@ -487,17 +487,17 @@ FetchBody(struct sess *sp)
CHECK_OBJ_NOTNULL
(
sp
,
SESS_MAGIC
);
CHECK_OBJ_NOTNULL
(
sp
->
wrk
,
WORKER_MAGIC
);
w
=
sp
->
wrk
;
CHECK_OBJ_NOTNULL
(
sp
->
obj
,
OBJECT_MAGIC
);
CHECK_OBJ_NOTNULL
(
sp
->
obj
->
http
,
HTTP_MAGIC
);
CHECK_OBJ_NOTNULL
(
obj
,
OBJECT_MAGIC
);
CHECK_OBJ_NOTNULL
(
obj
->
http
,
HTTP_MAGIC
);
if
(
w
->
vfp
==
NULL
)
w
->
vfp
=
&
vfp_nop
;
AN
(
sp
->
director
);
AssertObjCorePassOrBusy
(
sp
->
obj
->
objcore
);
AssertObjCorePassOrBusy
(
obj
->
objcore
);
AZ
(
w
->
vgz_rx
);
AZ
(
VTAILQ_FIRST
(
&
sp
->
obj
->
store
));
AZ
(
VTAILQ_FIRST
(
&
obj
->
store
));
switch
(
w
->
body_status
)
{
case
BS_NONE
:
cls
=
0
;
...
...
@@ -541,57 +541,57 @@ FetchBody(struct sess *sp)
*/
AZ
(
vfp_nop_end
(
sp
));
WSL
(
w
,
SLT_Fetch_Body
,
sp
->
wrk
->
vbc
->
vsl_id
,
"%u(%s) cls %d mklen %u"
,
WSL
(
w
,
SLT_Fetch_Body
,
w
->
vbc
->
vsl_id
,
"%u(%s) cls %d mklen %u"
,
w
->
body_status
,
body_status
(
w
->
body_status
),
cls
,
mklen
);
if
(
w
->
body_status
==
BS_ERROR
)
{
VDI_CloseFd
(
sp
->
wrk
);
VDI_CloseFd
(
w
);
return
(
__LINE__
);
}
if
(
cls
<
0
)
{
w
->
stats
.
fetch_failed
++
;
/* XXX: Wouldn't this store automatically be released ? */
while
(
!
VTAILQ_EMPTY
(
&
sp
->
obj
->
store
))
{
st
=
VTAILQ_FIRST
(
&
sp
->
obj
->
store
);
VTAILQ_REMOVE
(
&
sp
->
obj
->
store
,
st
,
list
);
while
(
!
VTAILQ_EMPTY
(
&
obj
->
store
))
{
st
=
VTAILQ_FIRST
(
&
obj
->
store
);
VTAILQ_REMOVE
(
&
obj
->
store
,
st
,
list
);
STV_free
(
st
);
}
VDI_CloseFd
(
sp
->
wrk
);
sp
->
obj
->
len
=
0
;
VDI_CloseFd
(
w
);
obj
->
len
=
0
;
return
(
__LINE__
);
}
if
(
cls
==
0
&&
w
->
do_close
)
cls
=
1
;
WSL
(
w
,
SLT_Length
,
sp
->
wrk
->
vbc
->
vsl_id
,
"%u"
,
sp
->
obj
->
len
);
WSL
(
w
,
SLT_Length
,
w
->
vbc
->
vsl_id
,
"%u"
,
obj
->
len
);
{
/* Sanity check fetch methods accounting */
ssize_t
uu
;
uu
=
0
;
VTAILQ_FOREACH
(
st
,
&
sp
->
obj
->
store
,
list
)
VTAILQ_FOREACH
(
st
,
&
obj
->
store
,
list
)
uu
+=
st
->
len
;
if
(
sp
->
objcore
==
NULL
||
(
sp
->
objcore
->
flags
&
OC_F_PASS
))
/* Streaming might have started freeing stuff */
assert
(
uu
<=
sp
->
obj
->
len
);
assert
(
uu
<=
obj
->
len
);
else
assert
(
uu
==
sp
->
obj
->
len
);
assert
(
uu
==
obj
->
len
);
}
if
(
mklen
>
0
)
{
http_Unset
(
sp
->
obj
->
http
,
H_Content_Length
);
http_PrintfHeader
(
w
,
sp
->
vsl_id
,
sp
->
obj
->
http
,
"Content-Length: %jd"
,
(
intmax_t
)
sp
->
obj
->
len
);
http_Unset
(
obj
->
http
,
H_Content_Length
);
http_PrintfHeader
(
w
,
sp
->
vsl_id
,
obj
->
http
,
"Content-Length: %jd"
,
(
intmax_t
)
obj
->
len
);
}
if
(
cls
)
VDI_CloseFd
(
sp
->
wrk
);
VDI_CloseFd
(
w
);
else
VDI_RecycleFd
(
sp
->
wrk
);
VDI_RecycleFd
(
w
);
return
(
0
);
}
...
...
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