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
1c09b7b0
Commit
1c09b7b0
authored
Apr 07, 2015
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Turn http1_cleanup() into Req_Cleanup()
parent
01b46ff8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
73 deletions
+72
-73
cache.h
bin/varnishd/cache/cache.h
+1
-0
cache_req.c
bin/varnishd/cache/cache_req.c
+67
-0
cache_http1_fsm.c
bin/varnishd/http1/cache_http1_fsm.c
+4
-73
No files found.
bin/varnishd/cache/cache.h
View file @
1c09b7b0
...
@@ -986,6 +986,7 @@ void VRG_dorange(struct req *req, struct busyobj *bo, const char *r);
...
@@ -986,6 +986,7 @@ void VRG_dorange(struct req *req, struct busyobj *bo, const char *r);
/* cache_req.c */
/* cache_req.c */
struct
req
*
Req_New
(
const
struct
worker
*
,
struct
sess
*
);
struct
req
*
Req_New
(
const
struct
worker
*
,
struct
sess
*
);
void
Req_Release
(
struct
req
*
);
void
Req_Release
(
struct
req
*
);
int
Req_Cleanup
(
struct
sess
*
sp
,
struct
worker
*
wrk
,
struct
req
*
req
);
/* cache_session.c [SES] */
/* cache_session.c [SES] */
struct
sess
*
SES_New
(
struct
sesspool
*
);
struct
sess
*
SES_New
(
struct
sesspool
*
);
...
...
bin/varnishd/cache/cache_req.c
View file @
1c09b7b0
...
@@ -39,6 +39,8 @@
...
@@ -39,6 +39,8 @@
#include "cache.h"
#include "cache.h"
#include "vtim.h"
/*--------------------------------------------------------------------
/*--------------------------------------------------------------------
* Alloc/Free a request
* Alloc/Free a request
*/
*/
...
@@ -136,3 +138,68 @@ Req_Release(struct req *req)
...
@@ -136,3 +138,68 @@ Req_Release(struct req *req)
req
->
sp
=
NULL
;
req
->
sp
=
NULL
;
MPL_Free
(
pp
->
mpl_req
,
req
);
MPL_Free
(
pp
->
mpl_req
,
req
);
}
}
/*----------------------------------------------------------------------
*/
int
Req_Cleanup
(
struct
sess
*
sp
,
struct
worker
*
wrk
,
struct
req
*
req
)
{
CHECK_OBJ_NOTNULL
(
sp
,
SESS_MAGIC
);
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
assert
(
sp
==
req
->
sp
);
req
->
director_hint
=
NULL
;
req
->
restarts
=
0
;
AZ
(
req
->
esi_level
);
assert
(
req
->
top
==
req
);
if
(
req
->
vcl
!=
NULL
)
{
if
(
wrk
->
vcl
!=
NULL
)
VCL_Rel
(
&
wrk
->
vcl
);
wrk
->
vcl
=
req
->
vcl
;
req
->
vcl
=
NULL
;
}
VRTPRIV_dynamic_kill
(
sp
->
privs
,
(
uintptr_t
)
req
);
VRTPRIV_dynamic_kill
(
sp
->
privs
,
(
uintptr_t
)
&
req
->
top
);
/* Charge and log byte counters */
AN
(
req
->
vsl
->
wid
);
CNT_AcctLogCharge
(
wrk
->
stats
,
req
);
req
->
req_bodybytes
=
0
;
VSL_End
(
req
->
vsl
);
if
(
!
isnan
(
req
->
t_prev
)
&&
req
->
t_prev
>
0
.)
sp
->
t_idle
=
req
->
t_prev
;
else
sp
->
t_idle
=
W_TIM_real
(
wrk
);
req
->
t_first
=
NAN
;
req
->
t_prev
=
NAN
;
req
->
t_req
=
NAN
;
req
->
req_body_status
=
REQ_BODY_INIT
;
req
->
hash_always_miss
=
0
;
req
->
hash_ignore_busy
=
0
;
req
->
is_hit
=
0
;
if
(
sp
->
fd
>=
0
&&
req
->
doclose
!=
SC_NULL
)
SES_Close
(
sp
,
req
->
doclose
);
if
(
sp
->
fd
<
0
)
{
wrk
->
stats
->
sess_closed
++
;
AZ
(
req
->
vcl
);
Req_Release
(
req
);
SES_Delete
(
sp
,
SC_NULL
,
NAN
);
return
(
1
);
}
WS_Reset
(
req
->
ws
,
NULL
);
WS_Reset
(
wrk
->
aws
,
NULL
);
return
(
0
);
}
bin/varnishd/http1/cache_http1_fsm.c
View file @
1c09b7b0
...
@@ -40,76 +40,7 @@
...
@@ -40,76 +40,7 @@
#include "cache/cache.h"
#include "cache/cache.h"
#include "hash/hash_slinger.h"
#include "hash/hash_slinger.h"
#include "vcl.h"
#include "vtcp.h"
#include "vtcp.h"
#include "vtim.h"
/*----------------------------------------------------------------------
* This is the final state, figure out if we should close or recycle
* the client connection
*/
static
int
http1_cleanup
(
struct
sess
*
sp
,
struct
worker
*
wrk
,
struct
req
*
req
)
{
CHECK_OBJ_NOTNULL
(
sp
,
SESS_MAGIC
);
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
CHECK_OBJ_ORNULL
(
req
->
vcl
,
VCL_CONF_MAGIC
);
req
->
director_hint
=
NULL
;
req
->
restarts
=
0
;
AZ
(
req
->
esi_level
);
assert
(
req
->
top
==
req
);
if
(
req
->
vcl
!=
NULL
)
{
if
(
wrk
->
vcl
!=
NULL
)
VCL_Rel
(
&
wrk
->
vcl
);
wrk
->
vcl
=
req
->
vcl
;
req
->
vcl
=
NULL
;
}
VRTPRIV_dynamic_kill
(
sp
->
privs
,
(
uintptr_t
)
req
);
VRTPRIV_dynamic_kill
(
sp
->
privs
,
(
uintptr_t
)
&
req
->
top
);
/* Charge and log byte counters */
AN
(
req
->
vsl
->
wid
);
CNT_AcctLogCharge
(
wrk
->
stats
,
req
);
req
->
req_bodybytes
=
0
;
VSL_End
(
req
->
vsl
);
if
(
!
isnan
(
req
->
t_prev
)
&&
req
->
t_prev
>
0
.)
sp
->
t_idle
=
req
->
t_prev
;
else
sp
->
t_idle
=
W_TIM_real
(
wrk
);
req
->
t_first
=
NAN
;
req
->
t_prev
=
NAN
;
req
->
t_req
=
NAN
;
req
->
req_body_status
=
REQ_BODY_INIT
;
req
->
hash_always_miss
=
0
;
req
->
hash_ignore_busy
=
0
;
req
->
is_hit
=
0
;
if
(
sp
->
fd
>=
0
&&
req
->
doclose
!=
SC_NULL
)
SES_Close
(
sp
,
req
->
doclose
);
if
(
sp
->
fd
<
0
)
{
wrk
->
stats
->
sess_closed
++
;
AZ
(
req
->
vcl
);
Req_Release
(
req
);
SES_Delete
(
sp
,
SC_NULL
,
NAN
);
return
(
1
);
}
WS_Reset
(
req
->
ws
,
NULL
);
WS_Reset
(
wrk
->
aws
,
NULL
);
return
(
0
);
}
/*----------------------------------------------------------------------
/*----------------------------------------------------------------------
*/
*/
...
@@ -239,7 +170,7 @@ HTTP1_Session(struct worker *wrk, struct req *req)
...
@@ -239,7 +170,7 @@ HTTP1_Session(struct worker *wrk, struct req *req)
SES_Close
(
sp
,
SC_REM_CLOSE
);
SES_Close
(
sp
,
SC_REM_CLOSE
);
else
else
SES_Close
(
sp
,
SC_TX_ERROR
);
SES_Close
(
sp
,
SC_TX_ERROR
);
AN
(
http1_c
leanup
(
sp
,
wrk
,
req
));
AN
(
Req_C
leanup
(
sp
,
wrk
,
req
));
return
;
return
;
}
}
...
@@ -251,7 +182,7 @@ HTTP1_Session(struct worker *wrk, struct req *req)
...
@@ -251,7 +182,7 @@ HTTP1_Session(struct worker *wrk, struct req *req)
SES_Close
(
sp
,
SC_REM_CLOSE
);
SES_Close
(
sp
,
SC_REM_CLOSE
);
else
else
SES_Close
(
sp
,
SC_TX_ERROR
);
SES_Close
(
sp
,
SC_TX_ERROR
);
AN
(
http1_c
leanup
(
sp
,
wrk
,
req
));
AN
(
Req_C
leanup
(
sp
,
wrk
,
req
));
return
;
return
;
}
}
sp
->
sess_step
=
S_STP_H1NEWREQ
;
sp
->
sess_step
=
S_STP_H1NEWREQ
;
...
@@ -309,7 +240,7 @@ HTTP1_Session(struct worker *wrk, struct req *req)
...
@@ -309,7 +240,7 @@ HTTP1_Session(struct worker *wrk, struct req *req)
(
void
)
HSH_DerefObjHead
(
wrk
,
&
req
->
hash_objhead
);
(
void
)
HSH_DerefObjHead
(
wrk
,
&
req
->
hash_objhead
);
AZ
(
req
->
hash_objhead
);
AZ
(
req
->
hash_objhead
);
SES_Close
(
sp
,
SC_REM_CLOSE
);
SES_Close
(
sp
,
SC_REM_CLOSE
);
AN
(
http1_c
leanup
(
sp
,
wrk
,
req
));
AN
(
Req_C
leanup
(
sp
,
wrk
,
req
));
return
;
return
;
}
}
sp
->
sess_step
=
S_STP_H1PROC
;
sp
->
sess_step
=
S_STP_H1PROC
;
...
@@ -331,7 +262,7 @@ HTTP1_Session(struct worker *wrk, struct req *req)
...
@@ -331,7 +262,7 @@ HTTP1_Session(struct worker *wrk, struct req *req)
sp
->
sess_step
=
S_STP_H1CLEANUP
;
sp
->
sess_step
=
S_STP_H1CLEANUP
;
break
;
break
;
case
S_STP_H1CLEANUP
:
case
S_STP_H1CLEANUP
:
if
(
http1_c
leanup
(
sp
,
wrk
,
req
))
if
(
Req_C
leanup
(
sp
,
wrk
,
req
))
return
;
return
;
SES_RxReInit
(
req
->
htc
);
SES_RxReInit
(
req
->
htc
);
if
(
HTTP1_Complete
(
req
->
htc
)
==
HTC_S_COMPLETE
)
{
if
(
HTTP1_Complete
(
req
->
htc
)
==
HTC_S_COMPLETE
)
{
...
...
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