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
c7611af5
Commit
c7611af5
authored
Sep 25, 2014
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move the last bits of file descriptor awareness out of the "abstract"
director layer.
parent
e3862554
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
65 deletions
+67
-65
cache_backend.c
bin/varnishd/cache/cache_backend.c
+56
-2
cache_backend.h
bin/varnishd/cache/cache_backend.h
+1
-2
cache_dir.c
bin/varnishd/cache/cache_dir.c
+4
-55
cache_http1_fetch.c
bin/varnishd/cache/cache_http1_fetch.c
+4
-4
cache_pipe.c
bin/varnishd/cache/cache_pipe.c
+2
-2
No files found.
bin/varnishd/cache/cache_backend.c
View file @
c7611af5
...
@@ -355,6 +355,60 @@ VBE_DiscardHealth(const struct director *vdi)
...
@@ -355,6 +355,60 @@ VBE_DiscardHealth(const struct director *vdi)
VBP_Remove
(
vs
->
backend
,
vs
->
vrt
->
probe
);
VBP_Remove
(
vs
->
backend
,
vs
->
vrt
->
probe
);
}
}
/* Close a connection ------------------------------------------------*/
void
VBE_CloseFd
(
struct
vbc
**
vbp
,
const
struct
acct_bereq
*
acct_bereq
)
{
struct
backend
*
bp
;
struct
vbc
*
vc
;
AN
(
vbp
);
vc
=
*
vbp
;
*
vbp
=
NULL
;
CHECK_OBJ_NOTNULL
(
vc
,
VBC_MAGIC
);
CHECK_OBJ_NOTNULL
(
vc
->
backend
,
BACKEND_MAGIC
);
assert
(
vc
->
fd
>=
0
);
bp
=
vc
->
backend
;
VSLb
(
vc
->
vsl
,
SLT_BackendClose
,
"%d %s"
,
vc
->
fd
,
bp
->
display_name
);
vc
->
vsl
=
NULL
;
VTCP_close
(
&
vc
->
fd
);
VBE_DropRefConn
(
bp
,
acct_bereq
);
vc
->
backend
=
NULL
;
VBE_ReleaseConn
(
vc
);
}
/* Recycle a connection ----------------------------------------------*/
static
void
vbe_RecycleFd
(
struct
vbc
**
vbp
,
const
struct
acct_bereq
*
acct_bereq
)
{
struct
backend
*
bp
;
struct
vbc
*
vc
;
AN
(
vbp
);
vc
=
*
vbp
;
*
vbp
=
NULL
;
CHECK_OBJ_NOTNULL
(
vc
,
VBC_MAGIC
);
CHECK_OBJ_NOTNULL
(
vc
->
backend
,
BACKEND_MAGIC
);
assert
(
vc
->
fd
>=
0
);
bp
=
vc
->
backend
;
VSLb
(
vc
->
vsl
,
SLT_BackendReuse
,
"%d %s"
,
vc
->
fd
,
bp
->
display_name
);
vc
->
vsl
=
NULL
;
Lck_Lock
(
&
bp
->
mtx
);
VSC_C_main
->
backend_recycle
++
;
VTAILQ_INSERT_HEAD
(
&
bp
->
connlist
,
vc
,
list
);
VBE_DropRefLocked
(
bp
,
acct_bereq
);
}
/*--------------------------------------------------------------------
/*--------------------------------------------------------------------
*
*
*/
*/
...
@@ -453,9 +507,9 @@ vdi_simple_finish(const struct director *d, struct worker *wrk,
...
@@ -453,9 +507,9 @@ vdi_simple_finish(const struct director *d, struct worker *wrk,
if
(
bo
->
vbc
!=
NULL
)
{
if
(
bo
->
vbc
!=
NULL
)
{
if
(
bo
->
doclose
!=
SC_NULL
)
if
(
bo
->
doclose
!=
SC_NULL
)
V
DI
_CloseFd
(
&
bo
->
vbc
,
&
bo
->
acct
);
V
BE
_CloseFd
(
&
bo
->
vbc
,
&
bo
->
acct
);
else
else
VDI
_RecycleFd
(
&
bo
->
vbc
,
&
bo
->
acct
);
vbe
_RecycleFd
(
&
bo
->
vbc
,
&
bo
->
acct
);
}
}
}
}
...
...
bin/varnishd/cache/cache_backend.h
View file @
c7611af5
...
@@ -142,6 +142,7 @@ struct vbc {
...
@@ -142,6 +142,7 @@ struct vbc {
void
VBE_ReleaseConn
(
struct
vbc
*
vc
);
void
VBE_ReleaseConn
(
struct
vbc
*
vc
);
void
VBE_UseHealth
(
const
struct
director
*
vdi
);
void
VBE_UseHealth
(
const
struct
director
*
vdi
);
void
VBE_DiscardHealth
(
const
struct
director
*
vdi
);
void
VBE_DiscardHealth
(
const
struct
director
*
vdi
);
void
VBE_CloseFd
(
struct
vbc
**
vbp
,
const
struct
acct_bereq
*
);
/* cache_backend_cfg.c */
/* cache_backend_cfg.c */
void
VBE_DropRefConn
(
struct
backend
*
,
const
struct
acct_bereq
*
);
void
VBE_DropRefConn
(
struct
backend
*
,
const
struct
acct_bereq
*
);
...
@@ -167,8 +168,6 @@ void VDI_Finish(const struct director *d, struct worker *wrk,
...
@@ -167,8 +168,6 @@ void VDI_Finish(const struct director *d, struct worker *wrk,
struct
vbc
*
VDI_GetFd
(
const
struct
director
*
d
,
struct
worker
*
wrk
,
struct
vbc
*
VDI_GetFd
(
const
struct
director
*
d
,
struct
worker
*
wrk
,
struct
busyobj
*
);
struct
busyobj
*
);
int
VDI_Healthy
(
const
struct
director
*
);
int
VDI_Healthy
(
const
struct
director
*
);
void
VDI_CloseFd
(
struct
vbc
**
vbp
,
const
struct
acct_bereq
*
);
void
VDI_RecycleFd
(
struct
vbc
**
vbp
,
const
struct
acct_bereq
*
);
void
VDI_AddHostHeader
(
struct
http
*
to
,
const
struct
vbc
*
vbc
);
void
VDI_AddHostHeader
(
struct
http
*
to
,
const
struct
vbc
*
vbc
);
void
VBE_Poll
(
void
);
void
VBE_Poll
(
void
);
void
VDI_Init
(
void
);
void
VDI_Init
(
void
);
...
...
bin/varnishd/cache/cache_dir.c
View file @
c7611af5
...
@@ -26,7 +26,10 @@
...
@@ -26,7 +26,10 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* SUCH DAMAGE.
*
*
* Abstract backend API
* Abstract director API
*
* The abstract director API does not know how we talk to the backend or
* if there even is one in the usual meaning of the word.
*
*
*/
*/
...
@@ -35,60 +38,6 @@
...
@@ -35,60 +38,6 @@
#include "cache.h"
#include "cache.h"
#include "cache_backend.h"
#include "cache_backend.h"
#include "vtcp.h"
/* Close a connection ------------------------------------------------*/
void
VDI_CloseFd
(
struct
vbc
**
vbp
,
const
struct
acct_bereq
*
acct_bereq
)
{
struct
backend
*
bp
;
struct
vbc
*
vc
;
AN
(
vbp
);
vc
=
*
vbp
;
*
vbp
=
NULL
;
CHECK_OBJ_NOTNULL
(
vc
,
VBC_MAGIC
);
CHECK_OBJ_NOTNULL
(
vc
->
backend
,
BACKEND_MAGIC
);
assert
(
vc
->
fd
>=
0
);
bp
=
vc
->
backend
;
VSLb
(
vc
->
vsl
,
SLT_BackendClose
,
"%d %s"
,
vc
->
fd
,
bp
->
display_name
);
vc
->
vsl
=
NULL
;
VTCP_close
(
&
vc
->
fd
);
VBE_DropRefConn
(
bp
,
acct_bereq
);
vc
->
backend
=
NULL
;
VBE_ReleaseConn
(
vc
);
}
/* Recycle a connection ----------------------------------------------*/
void
VDI_RecycleFd
(
struct
vbc
**
vbp
,
const
struct
acct_bereq
*
acct_bereq
)
{
struct
backend
*
bp
;
struct
vbc
*
vc
;
AN
(
vbp
);
vc
=
*
vbp
;
*
vbp
=
NULL
;
CHECK_OBJ_NOTNULL
(
vc
,
VBC_MAGIC
);
CHECK_OBJ_NOTNULL
(
vc
->
backend
,
BACKEND_MAGIC
);
assert
(
vc
->
fd
>=
0
);
bp
=
vc
->
backend
;
VSLb
(
vc
->
vsl
,
SLT_BackendReuse
,
"%d %s"
,
vc
->
fd
,
bp
->
display_name
);
vc
->
vsl
=
NULL
;
Lck_Lock
(
&
bp
->
mtx
);
VSC_C_main
->
backend_recycle
++
;
VTAILQ_INSERT_HEAD
(
&
bp
->
connlist
,
vc
,
list
);
VBE_DropRefLocked
(
bp
,
acct_bereq
);
}
/* Resolve director --------------------------------------------------*/
/* Resolve director --------------------------------------------------*/
...
...
bin/varnishd/cache/cache_http1_fetch.c
View file @
c7611af5
...
@@ -143,7 +143,7 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo)
...
@@ -143,7 +143,7 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo)
VSLb
(
bo
->
vsl
,
SLT_FetchError
,
"backend write error: %d (%s)"
,
VSLb
(
bo
->
vsl
,
SLT_FetchError
,
"backend write error: %d (%s)"
,
errno
,
strerror
(
errno
));
errno
,
strerror
(
errno
));
VSLb_ts_busyobj
(
bo
,
"Bereq"
,
W_TIM_real
(
wrk
));
VSLb_ts_busyobj
(
bo
,
"Bereq"
,
W_TIM_real
(
wrk
));
V
DI
_CloseFd
(
&
bo
->
vbc
,
&
bo
->
acct
);
V
BE
_CloseFd
(
&
bo
->
vbc
,
&
bo
->
acct
);
/* XXX: other cleanup ? */
/* XXX: other cleanup ? */
return
(
retry
);
return
(
retry
);
}
}
...
@@ -169,7 +169,7 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo)
...
@@ -169,7 +169,7 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo)
VSLb
(
bo
->
vsl
,
SLT_FetchError
,
VSLb
(
bo
->
vsl
,
SLT_FetchError
,
"http %sread error: overflow"
,
"http %sread error: overflow"
,
first
?
"first "
:
""
);
first
?
"first "
:
""
);
V
DI
_CloseFd
(
&
bo
->
vbc
,
&
bo
->
acct
);
V
BE
_CloseFd
(
&
bo
->
vbc
,
&
bo
->
acct
);
/* XXX: other cleanup ? */
/* XXX: other cleanup ? */
return
(
-
1
);
return
(
-
1
);
}
}
...
@@ -177,7 +177,7 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo)
...
@@ -177,7 +177,7 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo)
bo
->
acct
.
beresp_hdrbytes
+=
Tlen
(
htc
->
rxbuf
);
bo
->
acct
.
beresp_hdrbytes
+=
Tlen
(
htc
->
rxbuf
);
VSLb
(
bo
->
vsl
,
SLT_FetchError
,
"http %sread error: EOF"
,
VSLb
(
bo
->
vsl
,
SLT_FetchError
,
"http %sread error: EOF"
,
first
?
"first "
:
""
);
first
?
"first "
:
""
);
V
DI
_CloseFd
(
&
bo
->
vbc
,
&
bo
->
acct
);
V
BE
_CloseFd
(
&
bo
->
vbc
,
&
bo
->
acct
);
/* XXX: other cleanup ? */
/* XXX: other cleanup ? */
return
(
retry
);
return
(
retry
);
}
}
...
@@ -194,7 +194,7 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo)
...
@@ -194,7 +194,7 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo)
if
(
HTTP1_DissectResponse
(
hp
,
htc
))
{
if
(
HTTP1_DissectResponse
(
hp
,
htc
))
{
VSLb
(
bo
->
vsl
,
SLT_FetchError
,
"http format error"
);
VSLb
(
bo
->
vsl
,
SLT_FetchError
,
"http format error"
);
V
DI
_CloseFd
(
&
bo
->
vbc
,
&
bo
->
acct
);
V
BE
_CloseFd
(
&
bo
->
vbc
,
&
bo
->
acct
);
/* XXX: other cleanup ? */
/* XXX: other cleanup ? */
return
(
-
1
);
return
(
-
1
);
}
}
...
...
bin/varnishd/cache/cache_pipe.c
View file @
c7611af5
...
@@ -141,7 +141,7 @@ PipeRequest(struct req *req, struct busyobj *bo)
...
@@ -141,7 +141,7 @@ PipeRequest(struct req *req, struct busyobj *bo)
if
(
i
)
{
if
(
i
)
{
pipecharge
(
req
,
&
acct_pipe
,
vc
->
backend
->
vsc
);
pipecharge
(
req
,
&
acct_pipe
,
vc
->
backend
->
vsc
);
SES_Close
(
req
->
sp
,
SC_TX_PIPE
);
SES_Close
(
req
->
sp
,
SC_TX_PIPE
);
V
DI
_CloseFd
(
&
vc
,
NULL
);
V
BE
_CloseFd
(
&
vc
,
NULL
);
return
;
return
;
}
}
...
@@ -183,7 +183,7 @@ PipeRequest(struct req *req, struct busyobj *bo)
...
@@ -183,7 +183,7 @@ PipeRequest(struct req *req, struct busyobj *bo)
VSLb_ts_req
(
req
,
"PipeSess"
,
W_TIM_real
(
wrk
));
VSLb_ts_req
(
req
,
"PipeSess"
,
W_TIM_real
(
wrk
));
pipecharge
(
req
,
&
acct_pipe
,
vc
->
backend
->
vsc
);
pipecharge
(
req
,
&
acct_pipe
,
vc
->
backend
->
vsc
);
SES_Close
(
req
->
sp
,
SC_TX_PIPE
);
SES_Close
(
req
->
sp
,
SC_TX_PIPE
);
V
DI
_CloseFd
(
&
vc
,
NULL
);
V
BE
_CloseFd
(
&
vc
,
NULL
);
bo
->
vbc
=
NULL
;
bo
->
vbc
=
NULL
;
}
}
...
...
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