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
fb711185
Commit
fb711185
authored
Mar 24, 2015
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try to make the H1 state engine look more like one.
parent
dedff8e1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
26 deletions
+45
-26
cache.h
bin/varnishd/cache/cache.h
+1
-1
cache_session.c
bin/varnishd/cache/cache_session.c
+0
-1
cache_http1_fsm.c
bin/varnishd/http1/cache_http1_fsm.c
+44
-24
No files found.
bin/varnishd/cache/cache.h
View file @
fb711185
...
@@ -989,7 +989,7 @@ enum htc_status_e {
...
@@ -989,7 +989,7 @@ enum htc_status_e {
HTC_S_TIMEOUT
=
-
3
,
HTC_S_TIMEOUT
=
-
3
,
HTC_S_OVERFLOW
=
-
2
,
HTC_S_OVERFLOW
=
-
2
,
HTC_S_EOF
=
-
1
,
HTC_S_EOF
=
-
1
,
HTC_S_OK
=
0
,
HTC_S_OK
=
0
,
HTC_S_COMPLETE
=
1
HTC_S_COMPLETE
=
1
};
};
...
...
bin/varnishd/cache/cache_session.c
View file @
fb711185
...
@@ -330,7 +330,6 @@ SES_Proto_Sess(struct worker *wrk, void *arg)
...
@@ -330,7 +330,6 @@ SES_Proto_Sess(struct worker *wrk, void *arg)
cache_param
->
http_req_size
,
cache_param
->
http_req_hdr_len
);
cache_param
->
http_req_size
,
cache_param
->
http_req_hdr_len
);
if
(
sp
->
sess_step
<
S_STP_H1_LAST
)
{
if
(
sp
->
sess_step
<
S_STP_H1_LAST
)
{
sp
->
sess_step
=
S_STP_H1NEWREQ
;
wrk
->
task
.
func
=
SES_Proto_Req
;
wrk
->
task
.
func
=
SES_Proto_Req
;
wrk
->
task
.
priv
=
req
;
wrk
->
task
.
priv
=
req
;
}
else
if
(
sp
->
sess_step
<
S_STP_PROXY_LAST
)
{
}
else
if
(
sp
->
sess_step
<
S_STP_PROXY_LAST
)
{
...
...
bin/varnishd/http1/cache_http1_fsm.c
View file @
fb711185
...
@@ -331,31 +331,55 @@ HTTP1_Session(struct worker *wrk, struct req *req)
...
@@ -331,31 +331,55 @@ HTTP1_Session(struct worker *wrk, struct req *req)
return
;
return
;
}
}
/*
* Return from waitinglist. Check to see if the remote has left.
*/
if
(
req
->
req_step
==
R_STP_LOOKUP
&&
VTCP_check_hup
(
sp
->
fd
))
{
AN
(
req
->
hash_objhead
);
(
void
)
HSH_DerefObjHead
(
wrk
,
&
req
->
hash_objhead
);
AZ
(
req
->
hash_objhead
);
SES_Close
(
sp
,
SC_REM_CLOSE
);
AN
(
http1_cleanup
(
sp
,
wrk
,
req
));
return
;
}
while
(
1
)
{
while
(
1
)
{
assert
(
switch
(
sp
->
sess_step
)
{
sp
->
sess_step
==
S_STP_H1NEWREQ
||
case
S_STP_H1NEWSESS
:
req
->
req_step
==
R_STP_LOOKUP
||
if
(
VTCP_blocking
(
sp
->
fd
))
{
req
->
req_step
==
R_STP_RECV
);
if
(
errno
==
ECONNRESET
)
SES_Close
(
sp
,
SC_REM_CLOSE
);
else
SES_Close
(
sp
,
SC_TX_ERROR
);
AN
(
http1_cleanup
(
sp
,
wrk
,
req
));
return
;
}
sp
->
sess_step
=
S_STP_H1NEWREQ
;
break
;
case
S_STP_H1NEWREQ
:
nxt
=
http1_wait
(
sp
,
wrk
,
req
);
if
(
nxt
!=
REQ_FSM_MORE
)
return
;
sp
->
sess_step
=
S_STP_H1WORKING
;
req
->
req_step
=
R_STP_RECV
;
break
;
case
S_STP_H1BUSY
:
/*
* Return from waitinglist.
* Check to see if the remote has left.
*/
if
(
VTCP_check_hup
(
sp
->
fd
))
{
AN
(
req
->
hash_objhead
);
(
void
)
HSH_DerefObjHead
(
wrk
,
&
req
->
hash_objhead
);
AZ
(
req
->
hash_objhead
);
SES_Close
(
sp
,
SC_REM_CLOSE
);
AN
(
http1_cleanup
(
sp
,
wrk
,
req
));
return
;
}
sp
->
sess_step
=
S_STP_H1WORKING
;
break
;
case
S_STP_H1WORKING
:
assert
(
req
->
req_step
==
R_STP_LOOKUP
||
req
->
req_step
==
R_STP_RECV
);
if
(
sp
->
sess_step
==
S_STP_H1WORKING
)
{
if
(
req
->
req_step
==
R_STP_RECV
)
if
(
req
->
req_step
==
R_STP_RECV
)
nxt
=
http1_dissect
(
wrk
,
req
);
nxt
=
http1_dissect
(
wrk
,
req
);
if
(
nxt
==
REQ_FSM_MORE
)
if
(
nxt
==
REQ_FSM_MORE
)
nxt
=
CNT_Request
(
wrk
,
req
);
nxt
=
CNT_Request
(
wrk
,
req
);
if
(
nxt
==
REQ_FSM_DISEMBARK
)
if
(
nxt
==
REQ_FSM_DISEMBARK
)
{
sp
->
sess_step
=
S_STP_H1BUSY
;
return
;
return
;
}
assert
(
nxt
==
REQ_FSM_DONE
);
assert
(
nxt
==
REQ_FSM_DONE
);
if
(
http1_cleanup
(
sp
,
wrk
,
req
))
if
(
http1_cleanup
(
sp
,
wrk
,
req
))
return
;
return
;
...
@@ -373,14 +397,10 @@ HTTP1_Session(struct worker *wrk, struct req *req)
...
@@ -373,14 +397,10 @@ HTTP1_Session(struct worker *wrk, struct req *req)
wrk
->
stats
->
sess_readahead
++
;
wrk
->
stats
->
sess_readahead
++
;
sp
->
sess_step
=
S_STP_H1NEWREQ
;
sp
->
sess_step
=
S_STP_H1NEWREQ
;
}
}
break
;
default:
WRONG
(
"Wrong H1 session state"
);
}
}
if
(
sp
->
sess_step
==
S_STP_H1NEWREQ
)
{
nxt
=
http1_wait
(
sp
,
wrk
,
req
);
if
(
nxt
!=
REQ_FSM_MORE
)
return
;
sp
->
sess_step
=
S_STP_H1WORKING
;
req
->
req_step
=
R_STP_RECV
;
}
}
}
}
}
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