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
4133b274
Commit
4133b274
authored
Oct 24, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Push sess out of the stream-polling operation.
parent
9765f1a8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
27 deletions
+29
-27
cache.h
bin/varnishd/cache.h
+2
-2
cache_esi_deliver.c
bin/varnishd/cache_esi_deliver.c
+1
-1
cache_fetch.c
bin/varnishd/cache_fetch.c
+1
-1
cache_gzip.c
bin/varnishd/cache_gzip.c
+8
-8
cache_response.c
bin/varnishd/cache_response.c
+17
-15
No files found.
bin/varnishd/cache.h
View file @
4133b274
...
...
@@ -722,7 +722,7 @@ int VGZ_Gzip(struct vgz *, const void **, size_t *len, enum vgz_flag);
int
VGZ_Gunzip
(
struct
vgz
*
,
const
void
**
,
size_t
*
len
);
void
VGZ_Destroy
(
struct
vgz
**
);
void
VGZ_UpdateObj
(
const
struct
vgz
*
,
struct
object
*
);
int
VGZ_WrwGunzip
(
const
struct
sess
*
,
struct
vgz
*
,
const
void
*
ibuf
,
int
VGZ_WrwGunzip
(
struct
worker
*
w
,
struct
vgz
*
,
const
void
*
ibuf
,
ssize_t
ibufl
,
char
*
obuf
,
ssize_t
obufl
,
ssize_t
*
obufp
);
/* Return values */
...
...
@@ -898,7 +898,7 @@ void RES_BuildHttp(const struct sess *sp);
void
RES_WriteObj
(
struct
sess
*
sp
);
void
RES_StreamStart
(
struct
sess
*
sp
);
void
RES_StreamEnd
(
struct
sess
*
sp
);
void
RES_StreamPoll
(
const
struct
sess
*
sp
);
void
RES_StreamPoll
(
struct
worker
*
);
/* cache_vary.c */
struct
vsb
*
VRY_Create
(
const
struct
sess
*
sp
,
const
struct
http
*
hp
);
...
...
bin/varnishd/cache_esi_deliver.c
View file @
4133b274
...
...
@@ -330,7 +330,7 @@ ESI_Deliver(struct sess *sp)
* response
*/
AN
(
vgz
);
i
=
VGZ_WrwGunzip
(
sp
,
vgz
,
i
=
VGZ_WrwGunzip
(
sp
->
wrk
,
vgz
,
st
->
ptr
+
off
,
l2
,
obuf
,
sizeof
obuf
,
&
obufl
);
if
(
WRW_Error
(
sp
->
wrk
))
{
...
...
bin/varnishd/cache_fetch.c
View file @
4133b274
...
...
@@ -101,7 +101,7 @@ vfp_nop_bytes(struct sess *sp, struct http_conn *htc, ssize_t bytes)
sp
->
obj
->
len
+=
w
;
bytes
-=
w
;
if
(
sp
->
wrk
->
do_stream
)
RES_StreamPoll
(
sp
);
RES_StreamPoll
(
sp
->
wrk
);
}
return
(
1
);
}
...
...
bin/varnishd/cache_gzip.c
View file @
4133b274
...
...
@@ -350,7 +350,7 @@ VGZ_Gzip(struct vgz *vg, const void **pptr, size_t *plen, enum vgz_flag flags)
*/
int
VGZ_WrwGunzip
(
const
struct
sess
*
sp
,
struct
vgz
*
vg
,
const
void
*
ibuf
,
VGZ_WrwGunzip
(
struct
worker
*
w
,
struct
vgz
*
vg
,
const
void
*
ibuf
,
ssize_t
ibufl
,
char
*
obuf
,
ssize_t
obufl
,
ssize_t
*
obufp
)
{
int
i
;
...
...
@@ -375,9 +375,9 @@ VGZ_WrwGunzip(const struct sess *sp, struct vgz *vg, const void *ibuf,
return
(
-
1
);
}
if
(
obufl
==
*
obufp
||
i
==
VGZ_STUCK
)
{
sp
->
wrk
->
acct_tmp
.
bodybytes
+=
*
obufp
;
(
void
)
WRW_Write
(
sp
->
wrk
,
obuf
,
*
obufp
);
(
void
)
WRW_Flush
(
sp
->
wrk
);
w
->
acct_tmp
.
bodybytes
+=
*
obufp
;
(
void
)
WRW_Write
(
w
,
obuf
,
*
obufp
);
(
void
)
WRW_Flush
(
w
);
*
obufp
=
0
;
VGZ_Obuf
(
vg
,
obuf
+
*
obufp
,
obufl
-
*
obufp
);
}
...
...
@@ -474,7 +474,7 @@ vfp_gunzip_bytes(struct sess *sp, struct http_conn *htc, ssize_t bytes)
assert
(
i
==
VGZ_OK
||
i
==
VGZ_END
);
sp
->
obj
->
len
+=
dl
;
if
(
sp
->
wrk
->
do_stream
)
RES_StreamPoll
(
sp
);
RES_StreamPoll
(
sp
->
wrk
);
}
if
(
i
==
Z_OK
||
i
==
Z_STREAM_END
)
return
(
1
);
...
...
@@ -549,7 +549,7 @@ vfp_gzip_bytes(struct sess *sp, struct http_conn *htc, ssize_t bytes)
assert
(
i
==
Z_OK
);
sp
->
obj
->
len
+=
dl
;
if
(
sp
->
wrk
->
do_stream
)
RES_StreamPoll
(
sp
);
RES_StreamPoll
(
sp
->
wrk
);
}
return
(
1
);
}
...
...
@@ -573,7 +573,7 @@ vfp_gzip_end(struct sess *sp)
sp
->
obj
->
len
+=
dl
;
}
while
(
i
!=
Z_STREAM_END
);
if
(
sp
->
wrk
->
do_stream
)
RES_StreamPoll
(
sp
);
RES_StreamPoll
(
sp
->
wrk
);
VGZ_UpdateObj
(
vg
,
sp
->
obj
);
VGZ_Destroy
(
&
vg
);
return
(
0
);
...
...
@@ -631,7 +631,7 @@ vfp_testgzip_bytes(struct sess *sp, struct http_conn *htc, ssize_t bytes)
st
->
len
+=
w
;
sp
->
obj
->
len
+=
w
;
if
(
sp
->
wrk
->
do_stream
)
RES_StreamPoll
(
sp
);
RES_StreamPoll
(
sp
->
wrk
);
while
(
!
VGZ_IbufEmpty
(
vg
))
{
VGZ_Obuf
(
vg
,
obuf
,
sizeof
obuf
);
...
...
bin/varnishd/cache_response.c
View file @
4133b274
...
...
@@ -172,7 +172,7 @@ res_WriteGunzipObj(const struct sess *sp)
VSC_C_main
->
n_objwrite
++
;
i
=
VGZ_WrwGunzip
(
sp
,
vg
,
i
=
VGZ_WrwGunzip
(
sp
->
wrk
,
vg
,
st
->
ptr
,
st
->
len
,
obuf
,
sizeof
obuf
,
&
obufl
);
/* XXX: error check */
...
...
@@ -354,50 +354,52 @@ RES_StreamStart(struct sess *sp)
}
void
RES_StreamPoll
(
const
struct
sess
*
sp
)
RES_StreamPoll
(
struct
worker
*
w
)
{
struct
stream_ctx
*
sctx
;
struct
storage
*
st
;
ssize_t
l
,
l2
;
void
*
ptr
;
sctx
=
sp
->
wrk
->
sctx
;
CHECK_OBJ_NOTNULL
(
w
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
w
->
fetch_obj
,
OBJECT_MAGIC
);
sctx
=
w
->
sctx
;
CHECK_OBJ_NOTNULL
(
sctx
,
STREAM_CTX_MAGIC
);
if
(
sp
->
obj
->
len
==
sctx
->
stream_next
)
if
(
w
->
fetch_
obj
->
len
==
sctx
->
stream_next
)
return
;
assert
(
sp
->
obj
->
len
>
sctx
->
stream_next
);
assert
(
w
->
fetch_
obj
->
len
>
sctx
->
stream_next
);
l
=
sctx
->
stream_front
;
VTAILQ_FOREACH
(
st
,
&
sp
->
obj
->
store
,
list
)
{
VTAILQ_FOREACH
(
st
,
&
w
->
fetch_
obj
->
store
,
list
)
{
if
(
st
->
len
+
l
<=
sctx
->
stream_next
)
{
l
+=
st
->
len
;
continue
;
}
l2
=
st
->
len
+
l
-
sctx
->
stream_next
;
ptr
=
st
->
ptr
+
(
sctx
->
stream_next
-
l
);
if
(
sp
->
wrk
->
res_mode
&
RES_GUNZIP
)
{
(
void
)
VGZ_WrwGunzip
(
sp
,
sctx
->
vgz
,
ptr
,
l2
,
if
(
w
->
res_mode
&
RES_GUNZIP
)
{
(
void
)
VGZ_WrwGunzip
(
w
,
sctx
->
vgz
,
ptr
,
l2
,
sctx
->
obuf
,
sctx
->
obuf_len
,
&
sctx
->
obuf_ptr
);
}
else
{
(
void
)
WRW_Write
(
sp
->
wrk
,
ptr
,
l2
);
(
void
)
WRW_Write
(
w
,
ptr
,
l2
);
}
l
+=
st
->
len
;
sctx
->
stream_next
+=
l2
;
}
if
(
!
(
sp
->
wrk
->
res_mode
&
RES_GUNZIP
))
(
void
)
WRW_Flush
(
sp
->
wrk
);
if
(
!
(
w
->
res_mode
&
RES_GUNZIP
))
(
void
)
WRW_Flush
(
w
);
if
(
sp
->
obj
->
objcore
==
NULL
||
(
sp
->
obj
->
objcore
->
flags
&
OC_F_PASS
))
{
if
(
w
->
fetch_
obj
->
objcore
==
NULL
||
(
w
->
fetch_
obj
->
objcore
->
flags
&
OC_F_PASS
))
{
/*
* This is a pass object, release storage as soon as we
* have delivered it.
*/
while
(
1
)
{
st
=
VTAILQ_FIRST
(
&
sp
->
obj
->
store
);
st
=
VTAILQ_FIRST
(
&
w
->
fetch_
obj
->
store
);
if
(
st
==
NULL
||
sctx
->
stream_front
+
st
->
len
>
sctx
->
stream_next
)
break
;
VTAILQ_REMOVE
(
&
sp
->
obj
->
store
,
st
,
list
);
VTAILQ_REMOVE
(
&
w
->
fetch_
obj
->
store
,
st
,
list
);
sctx
->
stream_front
+=
st
->
len
;
STV_free
(
st
);
}
...
...
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