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
20a5abe7
Commit
20a5abe7
authored
Apr 22, 2013
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move VCL::handling from req to wrk
parent
d54e1ec9
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
45 additions
and
47 deletions
+45
-47
cache.h
bin/varnishd/cache/cache.h
+1
-1
cache_panic.c
bin/varnishd/cache/cache_panic.c
+7
-6
cache_req_fsm.c
bin/varnishd/cache/cache_req_fsm.c
+23
-23
cache_vcl.c
bin/varnishd/cache/cache_vcl.c
+4
-4
cache_vrt.c
bin/varnishd/cache/cache_vrt.c
+4
-4
vrt.h
include/vrt.h
+2
-7
vcc_action.c
lib/libvcl/vcc_action.c
+4
-2
No files found.
bin/varnishd/cache/cache.h
View file @
20a5abe7
...
...
@@ -349,6 +349,7 @@ struct worker {
struct
vxid_pool
vxid_pool
;
unsigned
handling
;
};
/* LRU ---------------------------------------------------------------*/
...
...
@@ -613,7 +614,6 @@ struct req {
enum
sess_close
doclose
;
struct
exp
exp
;
unsigned
cur_method
;
unsigned
handling
;
unsigned
char
wantbody
;
enum
req_body_state_e
req_body_status
;
...
...
bin/varnishd/cache/cache_panic.c
View file @
20a5abe7
...
...
@@ -225,9 +225,15 @@ pan_vcl(const struct VCL_conf *vcl)
static
void
pan_wrk
(
const
struct
worker
*
wrk
)
{
const
char
*
hand
;
VSB_printf
(
pan_vsp
,
" worker = %p {
\n
"
,
wrk
);
pan_ws
(
wrk
->
aws
,
4
);
hand
=
VCL_Return_Name
(
wrk
->
handling
);
if
(
hand
!=
NULL
)
VSB_printf
(
pan_vsp
,
" handling = %s,
\n
"
,
hand
);
else
VSB_printf
(
pan_vsp
,
" handling = 0x%x,
\n
"
,
wrk
->
handling
);
VSB_printf
(
pan_vsp
,
" },
\n
"
);
}
...
...
@@ -261,7 +267,7 @@ pan_busyobj(const struct busyobj *bo)
static
void
pan_req
(
const
struct
req
*
req
)
{
const
char
*
hand
,
*
stp
,
*
body
;
const
char
*
stp
,
*
body
;
VSB_printf
(
pan_vsp
,
"req = %p {
\n
"
,
req
);
...
...
@@ -290,11 +296,6 @@ pan_req(const struct req *req)
VSB_printf
(
pan_vsp
,
" req_body = 0x%x,
\n
"
,
req
->
req_body_status
);
hand
=
VCL_Return_Name
(
req
->
handling
);
if
(
hand
!=
NULL
)
VSB_printf
(
pan_vsp
,
" handling = %s,
\n
"
,
hand
);
else
VSB_printf
(
pan_vsp
,
" handling = 0x%x,
\n
"
,
req
->
handling
);
if
(
req
->
err_code
)
VSB_printf
(
pan_vsp
,
" err_code = %d, err_reason = %s,
\n
"
,
req
->
err_code
,
...
...
bin/varnishd/cache/cache_req_fsm.c
View file @
20a5abe7
...
...
@@ -159,7 +159,7 @@ cnt_prepresp(struct worker *wrk, struct req *req)
RES_BuildHttp
(
req
);
VCL_deliver_method
(
wrk
,
req
,
req
->
http
->
ws
);
switch
(
req
->
handling
)
{
switch
(
wrk
->
handling
)
{
case
VCL_RET_DELIVER
:
break
;
case
VCL_RET_RESTART
:
...
...
@@ -310,21 +310,21 @@ cnt_error(struct worker *wrk, struct req *req)
http_PutResponse
(
h
,
http_StatusMessage
(
req
->
err_code
));
VCL_error_method
(
wrk
,
req
,
req
->
http
->
ws
);
if
(
req
->
handling
==
VCL_RET_RESTART
&&
if
(
wrk
->
handling
==
VCL_RET_RESTART
&&
req
->
restarts
<
cache_param
->
max_restarts
)
{
HSH_Drop
(
wrk
,
&
req
->
obj
);
VBO_DerefBusyObj
(
wrk
,
&
req
->
busyobj
);
req
->
req_step
=
R_STP_RESTART
;
return
(
REQ_FSM_MORE
);
}
else
if
(
req
->
handling
==
VCL_RET_RESTART
)
req
->
handling
=
VCL_RET_DELIVER
;
}
else
if
(
wrk
->
handling
==
VCL_RET_RESTART
)
wrk
->
handling
=
VCL_RET_DELIVER
;
/* We always close when we take this path */
req
->
doclose
=
SC_TX_ERROR
;
req
->
wantbody
=
1
;
assert
(
req
->
handling
==
VCL_RET_DELIVER
);
assert
(
wrk
->
handling
==
VCL_RET_DELIVER
);
req
->
err_code
=
0
;
req
->
err_reason
=
NULL
;
http_Teardown
(
bo
->
bereq
);
...
...
@@ -382,7 +382,7 @@ cnt_fetch(struct worker *wrk, struct req *req)
}
if
(
i
)
{
req
->
handling
=
VCL_RET_ERROR
;
wrk
->
handling
=
VCL_RET_ERROR
;
req
->
err_code
=
503
;
}
else
{
/*
...
...
@@ -421,7 +421,7 @@ cnt_fetch(struct worker *wrk, struct req *req)
if
(
bo
->
do_pass
)
req
->
objcore
->
flags
|=
OC_F_PASS
;
switch
(
req
->
handling
)
{
switch
(
wrk
->
handling
)
{
case
VCL_RET_DELIVER
:
req
->
req_step
=
R_STP_FETCHBODY
;
return
(
REQ_FSM_MORE
);
...
...
@@ -437,8 +437,8 @@ cnt_fetch(struct worker *wrk, struct req *req)
AZ
(
bo
->
vbc
);
if
(
req
->
objcore
->
objhead
!=
NULL
||
req
->
handling
==
VCL_RET_RESTART
||
req
->
handling
==
VCL_RET_ERROR
)
{
wrk
->
handling
==
VCL_RET_RESTART
||
wrk
->
handling
==
VCL_RET_ERROR
)
{
CHECK_OBJ_NOTNULL
(
req
->
objcore
,
OBJCORE_MAGIC
);
AZ
(
HSH_Deref
(
&
wrk
->
stats
,
req
->
objcore
,
NULL
));
req
->
objcore
=
NULL
;
...
...
@@ -449,7 +449,7 @@ cnt_fetch(struct worker *wrk, struct req *req)
req
->
director
=
NULL
;
req
->
storage_hint
=
NULL
;
switch
(
req
->
handling
)
{
switch
(
wrk
->
handling
)
{
case
VCL_RET_RESTART
:
req
->
req_step
=
R_STP_RESTART
;
return
(
REQ_FSM_MORE
);
...
...
@@ -491,7 +491,7 @@ cnt_fetchbody(struct worker *wrk, struct req *req)
bo
=
req
->
busyobj
;
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
assert
(
req
->
handling
==
VCL_RET_DELIVER
);
assert
(
wrk
->
handling
==
VCL_RET_DELIVER
);
if
(
req
->
objcore
->
objhead
==
NULL
)
{
/* This is a pass from vcl_recv */
...
...
@@ -848,14 +848,14 @@ VSLb(req->vsl, SLT_Debug, "XXXX HIT\n");
VCL_lookup_method
(
wrk
,
req
,
req
->
http
->
ws
);
if
((
req
->
obj
->
objcore
->
flags
&
OC_F_PASS
)
&&
req
->
handling
==
VCL_RET_DELIVER
)
{
wrk
->
handling
==
VCL_RET_DELIVER
)
{
VSLb
(
req
->
vsl
,
SLT_VCL_Error
,
"obj.uncacheable set, but vcl_lookup{} returned 'deliver'"
", changing to 'pass'"
);
req
->
handling
=
VCL_RET_PASS
;
wrk
->
handling
=
VCL_RET_PASS
;
}
if
(
req
->
handling
==
VCL_RET_DELIVER
)
{
if
(
wrk
->
handling
==
VCL_RET_DELIVER
)
{
//AZ(req->busyobj->bereq->ws);
//AZ(req->busyobj->beresp->ws);
(
void
)
HTTP1_DiscardReqBody
(
req
);
// XXX: handle err
...
...
@@ -867,7 +867,7 @@ VSLb(req->vsl, SLT_Debug, "XXXX HIT\n");
(
void
)
HSH_Deref
(
&
wrk
->
stats
,
NULL
,
&
req
->
obj
);
req
->
objcore
=
NULL
;
switch
(
req
->
handling
)
{
switch
(
wrk
->
handling
)
{
case
VCL_RET_PASS
:
req
->
req_step
=
R_STP_PASS
;
break
;
...
...
@@ -926,7 +926,7 @@ cnt_miss(struct worker *wrk, struct req *req)
VCL_fetch_method
(
wrk
,
req
,
req
->
http
->
ws
);
VCL_miss_method
(
wrk
,
req
,
req
->
http
->
ws
);
if
(
req
->
handling
==
VCL_RET_FETCH
)
{
if
(
wrk
->
handling
==
VCL_RET_FETCH
)
{
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
req
->
req_step
=
R_STP_FETCH
;
return
(
REQ_FSM_MORE
);
...
...
@@ -937,7 +937,7 @@ cnt_miss(struct worker *wrk, struct req *req)
http_Teardown
(
bo
->
bereq
);
VBO_DerefBusyObj
(
wrk
,
&
req
->
busyobj
);
switch
(
req
->
handling
)
{
switch
(
wrk
->
handling
)
{
case
VCL_RET_ERROR
:
req
->
req_step
=
R_STP_ERROR
;
break
;
...
...
@@ -991,13 +991,13 @@ cnt_pass(struct worker *wrk, struct req *req)
VCL_fetch_method
(
wrk
,
req
,
req
->
http
->
ws
);
VCL_pass_method
(
wrk
,
req
,
req
->
http
->
ws
);
if
(
req
->
handling
==
VCL_RET_ERROR
)
{
if
(
wrk
->
handling
==
VCL_RET_ERROR
)
{
http_Teardown
(
bo
->
bereq
);
VBO_DerefBusyObj
(
wrk
,
&
req
->
busyobj
);
req
->
req_step
=
R_STP_ERROR
;
return
(
REQ_FSM_MORE
);
}
assert
(
req
->
handling
==
VCL_RET_PASS
);
assert
(
wrk
->
handling
==
VCL_RET_PASS
);
req
->
acct_req
.
pass
++
;
req
->
req_step
=
R_STP_FETCH
;
...
...
@@ -1049,9 +1049,9 @@ cnt_pipe(struct worker *wrk, struct req *req)
VCL_pipe_method
(
wrk
,
req
,
req
->
http
->
ws
);
if
(
req
->
handling
==
VCL_RET_ERROR
)
if
(
wrk
->
handling
==
VCL_RET_ERROR
)
INCOMPL
();
assert
(
req
->
handling
==
VCL_RET_PIPE
);
assert
(
wrk
->
handling
==
VCL_RET_PIPE
);
PipeRequest
(
req
);
assert
(
WRW_IsReleased
(
wrk
));
...
...
@@ -1154,7 +1154,7 @@ cnt_recv(struct worker *wrk, struct req *req)
http_CollectHdr
(
req
->
http
,
H_Cache_Control
);
VCL_recv_method
(
wrk
,
req
,
req
->
http
->
ws
);
recv_handling
=
req
->
handling
;
recv_handling
=
wrk
->
handling
;
if
(
cache_param
->
http_gzip_support
&&
(
recv_handling
!=
VCL_RET_PIPE
)
&&
...
...
@@ -1170,7 +1170,7 @@ cnt_recv(struct worker *wrk, struct req *req)
req
->
sha256ctx
=
&
sha256ctx
;
/* so HSH_AddString() can find it */
SHA256_Init
(
req
->
sha256ctx
);
VCL_hash_method
(
wrk
,
req
,
req
->
http
->
ws
);
assert
(
req
->
handling
==
VCL_RET_HASH
);
assert
(
wrk
->
handling
==
VCL_RET_HASH
);
SHA256_Final
(
req
->
digest
,
req
->
sha256ctx
);
req
->
sha256ctx
=
NULL
;
...
...
bin/varnishd/cache/cache_vcl.c
View file @
20a5abe7
...
...
@@ -345,15 +345,15 @@ VCL_##func##_method(struct worker *wrk, struct req *req, struct ws *ws) \
CHECK_OBJ_NOTNULL(req->sp, SESS_MAGIC); \
AN(req->sp); \
aws = WS_Snapshot(wrk->aws); \
req
->handling = 0; \
wrk
->handling = 0; \
req->cur_method = VCL_MET_ ## upper; \
VSLb(req->vsl, SLT_VCL_call, "%s", #func); \
(void)req->vcl->func##_func(wrk, req, NULL, ws); \
VSLb(req->vsl, SLT_VCL_return, "%s", \
VCL_Return_Name(
req
->handling)); \
VCL_Return_Name(
wrk
->handling)); \
req->cur_method = 0; \
assert((1U <<
req
->handling) & bitmap); \
assert(!((1U <<
req
->handling) & ~bitmap)); \
assert((1U <<
wrk
->handling) & bitmap); \
assert(!((1U <<
wrk
->handling) & ~bitmap)); \
WS_Reset(wrk->aws, aws); \
}
...
...
bin/varnishd/cache/cache_vrt.c
View file @
20a5abe7
...
...
@@ -258,16 +258,16 @@ VRT_SetHdr(struct req *req , const struct gethdr_s *hs, const char *p, ...)
/*--------------------------------------------------------------------*/
void
VRT_handling
(
struct
req
*
req
,
unsigned
hand
)
VRT_handling
(
struct
worker
*
wrk
,
unsigned
hand
)
{
if
(
req
==
NULL
)
{
if
(
wrk
==
NULL
)
{
assert
(
hand
==
VCL_RET_OK
);
return
;
}
CHECK_OBJ_NOTNULL
(
req
,
REQ
_MAGIC
);
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER
_MAGIC
);
assert
(
hand
<
VCL_RET_MAX
);
req
->
handling
=
hand
;
wrk
->
handling
=
hand
;
}
/*--------------------------------------------------------------------
...
...
include/vrt.h
View file @
20a5abe7
...
...
@@ -32,6 +32,7 @@
*/
struct
req
;
struct
worker
;
struct
ws
;
struct
vsb
;
struct
cli
;
...
...
@@ -179,7 +180,7 @@ int VRT_switch_config(const char *);
const
struct
gethdr_s
*
VRT_MkGethdr
(
struct
req
*
,
enum
gethdr_e
,
const
char
*
);
char
*
VRT_GetHdr
(
const
struct
req
*
,
const
struct
gethdr_s
*
);
void
VRT_SetHdr
(
struct
req
*
,
const
struct
gethdr_s
*
,
const
char
*
,
...);
void
VRT_handling
(
struct
req
*
,
unsigned
hand
);
void
VRT_handling
(
struct
worker
*
,
unsigned
hand
);
void
VRT_hashdata
(
struct
req
*
,
const
char
*
str
,
...);
...
...
@@ -231,10 +232,4 @@ char *VRT_TIME_string(struct ws *, double);
const
char
*
VRT_BOOL_string
(
unsigned
);
const
char
*
VRT_BACKEND_string
(
const
struct
director
*
d
);
#define VRT_done(req, hand) \
do { \
VRT_handling(req, hand); \
return (1); \
} while (0)
const
char
*
VRT_ReqString
(
struct
req
*
,
const
char
*
p
,
...);
lib/libvcl/vcc_action.c
View file @
20a5abe7
...
...
@@ -79,7 +79,8 @@ parse_error(struct vcc *tl)
Fb
(
tl
,
1
,
", 0
\n
"
);
}
Fb
(
tl
,
1
,
");
\n
"
);
Fb
(
tl
,
1
,
"VRT_done(req, VCL_RET_ERROR);
\n
"
);
Fb
(
tl
,
1
,
"VRT_handling(wrk, VCL_RET_ERROR);
\n
"
);
Fb
(
tl
,
1
,
"return(1);
\n
"
);
}
/*--------------------------------------------------------------------*/
...
...
@@ -311,7 +312,8 @@ parse_return(struct vcc *tl)
#define VCL_RET_MAC(l, U, B) \
do { \
if (vcc_IdIs(tl->t, #l)) { \
Fb(tl, 1, "VRT_done(req, VCL_RET_" #U ");\n"); \
Fb(tl, 1, "VRT_handling(wrk, VCL_RET_" #U ");\n"); \
Fb(tl, 1, "return (1);\n"); \
vcc_ProcAction(tl->curproc, VCL_RET_##U, tl->t);\
retval = 1; \
} \
...
...
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