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
06592130
Commit
06592130
authored
Nov 03, 2014
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove layer-breaking up-calls to VDI_Finish() and make VBE Do The
Right Thing instead.
parent
77849fda
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
43 deletions
+37
-43
cache_backend.c
bin/varnishd/cache/cache_backend.c
+35
-33
cache_director.c
bin/varnishd/cache/cache_director.c
+2
-2
cache_http1_fetch.c
bin/varnishd/http1/cache_http1_fetch.c
+0
-8
No files found.
bin/varnishd/cache/cache_backend.c
View file @
06592130
...
...
@@ -384,6 +384,39 @@ vbe_dir_healthy(const struct director *d, const struct busyobj *bo,
return
(
VBE_Healthy
(
be
,
changed
));
}
static
void
__match_proto__
(
vdi_finish_f
)
vbe_dir_finish
(
const
struct
director
*
d
,
struct
worker
*
wrk
,
struct
busyobj
*
bo
)
{
struct
backend
*
bp
;
CHECK_OBJ_NOTNULL
(
d
,
DIRECTOR_MAGIC
);
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
->
htc
,
HTTP_CONN_MAGIC
);
if
(
bo
->
htc
->
vbc
==
NULL
)
return
;
bp
=
bo
->
htc
->
vbc
->
backend
;
if
(
bo
->
doclose
!=
SC_NULL
)
{
VSLb
(
bo
->
vsl
,
SLT_BackendClose
,
"%d %s"
,
bo
->
htc
->
vbc
->
fd
,
bp
->
display_name
);
VTCP_close
(
&
bo
->
htc
->
vbc
->
fd
);
VBE_DropRefConn
(
bp
,
&
bo
->
acct
);
bo
->
htc
->
vbc
->
backend
=
NULL
;
VBE_ReleaseConn
(
bo
->
htc
->
vbc
);
}
else
{
VSLb
(
bo
->
vsl
,
SLT_BackendReuse
,
"%d %s"
,
bo
->
htc
->
vbc
->
fd
,
bp
->
display_name
);
Lck_Lock
(
&
bp
->
mtx
);
VSC_C_main
->
backend_recycle
++
;
VTAILQ_INSERT_HEAD
(
&
bp
->
connlist
,
bo
->
htc
->
vbc
,
list
);
VBE_DropRefLocked
(
bp
,
&
bo
->
acct
);
}
bo
->
htc
->
vbc
=
NULL
;
bo
->
htc
=
NULL
;
}
static
int
__match_proto__
(
vdi_gethdrs_f
)
vbe_dir_gethdrs
(
const
struct
director
*
d
,
struct
worker
*
wrk
,
struct
busyobj
*
bo
)
...
...
@@ -408,6 +441,7 @@ vbe_dir_gethdrs(const struct director *d, struct worker *wrk,
* Do a single retry in that case.
*/
if
(
i
==
1
)
{
vbe_dir_finish
(
d
,
wrk
,
bo
);
AZ
(
bo
->
htc
);
VSC_C_main
->
backend_retry
++
;
bo
->
doclose
=
SC_NULL
;
...
...
@@ -421,6 +455,7 @@ vbe_dir_gethdrs(const struct director *d, struct worker *wrk,
i
=
V1F_fetch_hdr
(
wrk
,
bo
);
}
if
(
i
!=
0
)
{
vbe_dir_finish
(
d
,
wrk
,
bo
);
bo
->
doclose
=
SC_NULL
;
AZ
(
bo
->
htc
);
}
else
{
...
...
@@ -442,39 +477,6 @@ vbe_dir_getbody(const struct director *d, struct worker *wrk,
return
(
0
);
}
static
void
__match_proto__
(
vdi_finish_f
)
vbe_dir_finish
(
const
struct
director
*
d
,
struct
worker
*
wrk
,
struct
busyobj
*
bo
)
{
struct
backend
*
bp
;
CHECK_OBJ_NOTNULL
(
d
,
DIRECTOR_MAGIC
);
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
->
htc
,
HTTP_CONN_MAGIC
);
if
(
bo
->
htc
->
vbc
==
NULL
)
return
;
bp
=
bo
->
htc
->
vbc
->
backend
;
if
(
bo
->
doclose
!=
SC_NULL
)
{
VSLb
(
bo
->
vsl
,
SLT_BackendClose
,
"%d %s"
,
bo
->
htc
->
vbc
->
fd
,
bp
->
display_name
);
VTCP_close
(
&
bo
->
htc
->
vbc
->
fd
);
VBE_DropRefConn
(
bp
,
&
bo
->
acct
);
bo
->
htc
->
vbc
->
backend
=
NULL
;
VBE_ReleaseConn
(
bo
->
htc
->
vbc
);
}
else
{
VSLb
(
bo
->
vsl
,
SLT_BackendReuse
,
"%d %s"
,
bo
->
htc
->
vbc
->
fd
,
bp
->
display_name
);
Lck_Lock
(
&
bp
->
mtx
);
VSC_C_main
->
backend_recycle
++
;
VTAILQ_INSERT_HEAD
(
&
bp
->
connlist
,
bo
->
htc
->
vbc
,
list
);
VBE_DropRefLocked
(
bp
,
&
bo
->
acct
);
}
bo
->
htc
->
vbc
=
NULL
;
bo
->
htc
=
NULL
;
}
static
struct
suckaddr
*
__match_proto__
(
vdi_suckaddr_f
)
vbe_dir_suckaddr
(
const
struct
director
*
d
,
struct
worker
*
wrk
,
struct
busyobj
*
bo
)
...
...
bin/varnishd/cache/cache_director.c
View file @
06592130
...
...
@@ -100,6 +100,7 @@ VDI_GetBody(const struct director *d, struct worker *wrk, struct busyobj *bo)
AZ
(
d
->
resolve
);
AN
(
d
->
getbody
);
assert
(
bo
->
director_state
==
DIR_S_HDRS
);
bo
->
director_state
=
DIR_S_BODY
;
return
(
d
->
getbody
(
d
,
wrk
,
bo
));
}
...
...
@@ -118,9 +119,8 @@ VDI_Finish(const struct director *d, struct worker *wrk, struct busyobj *bo)
AN
(
d
->
finish
);
assert
(
bo
->
director_state
!=
DIR_S_NULL
);
bo
->
director_state
=
DIR_S_NULL
;
d
->
finish
(
d
,
wrk
,
bo
);
bo
->
director_state
=
DIR_S_NULL
;
}
/* Get a connection --------------------------------------------------*/
...
...
bin/varnishd/http1/cache_http1_fetch.c
View file @
06592130
...
...
@@ -141,8 +141,6 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo)
errno
,
strerror
(
errno
));
VSLb_ts_busyobj
(
bo
,
"Bereq"
,
W_TIM_real
(
wrk
));
bo
->
doclose
=
SC_TX_ERROR
;
VDI_Finish
(
bo
->
director_resp
,
bo
->
wrk
,
bo
);
/* XXX: other cleanup ? */
return
(
retry
);
}
VSLb_ts_busyobj
(
bo
,
"Bereq"
,
W_TIM_real
(
wrk
));
...
...
@@ -168,8 +166,6 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo)
"http %sread error: overflow"
,
first
?
"first "
:
""
);
bo
->
doclose
=
SC_RX_OVERFLOW
;
VDI_Finish
(
bo
->
director_resp
,
bo
->
wrk
,
bo
);
/* XXX: other cleanup ? */
return
(
-
1
);
}
if
(
hs
==
HTTP1_ERROR_EOF
)
{
...
...
@@ -178,8 +174,6 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo)
VSLb
(
bo
->
vsl
,
SLT_FetchError
,
"http %sread error: EOF"
,
first
?
"first "
:
""
);
bo
->
doclose
=
SC_RX_TIMEOUT
;
VDI_Finish
(
bo
->
director_resp
,
bo
->
wrk
,
bo
);
/* XXX: other cleanup ? */
return
(
retry
);
}
if
(
first
)
{
...
...
@@ -196,8 +190,6 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo)
if
(
HTTP1_DissectResponse
(
hp
,
htc
))
{
VSLb
(
bo
->
vsl
,
SLT_FetchError
,
"http format error"
);
bo
->
doclose
=
SC_RX_JUNK
;
VDI_Finish
(
bo
->
director_resp
,
bo
->
wrk
,
bo
);
/* XXX: other cleanup ? */
return
(
-
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