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
2f6eaf09
Commit
2f6eaf09
authored
Jan 07, 2021
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Propagate the type of the connected to address all the way down
parent
cbfaf281
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
23 deletions
+20
-23
cache_backend.c
bin/varnishd/cache/cache_backend.c
+1
-1
cache_backend_probe.c
bin/varnishd/cache/cache_backend_probe.c
+1
-1
cache_tcp_pool.c
bin/varnishd/cache/cache_tcp_pool.c
+16
-19
cache_tcp_pool.h
bin/varnishd/cache/cache_tcp_pool.h
+2
-2
No files found.
bin/varnishd/cache/cache_backend.c
View file @
2f6eaf09
...
...
@@ -341,7 +341,7 @@ vbe_dir_getip(VRT_CTX, VCL_BACKEND d)
CHECK_OBJ_NOTNULL
(
ctx
->
bo
->
htc
,
HTTP_CONN_MAGIC
);
pfd
=
ctx
->
bo
->
htc
->
priv
;
return
(
VTP_
geti
p
(
pfd
));
return
(
VTP_
GetI
p
(
pfd
));
}
/*--------------------------------------------------------------------*/
...
...
bin/varnishd/cache/cache_backend_probe.c
View file @
2f6eaf09
...
...
@@ -285,7 +285,7 @@ vbp_poke(struct vbp_target *vt)
t_start
=
t_now
=
VTIM_real
();
t_end
=
t_start
+
vt
->
timeout
;
s
=
VTP_Open
(
vt
->
tcp_pool
,
t_end
-
t_now
,
(
const
void
**
)
&
sa
,
&
err
);
s
=
VTP_Open
(
vt
->
tcp_pool
,
t_end
-
t_now
,
&
sa
,
&
err
);
if
(
s
<
0
)
{
bprintf
(
vt
->
resp_buf
,
"Open error %d (%s)"
,
err
,
vstrerror
(
err
));
Lck_Lock
(
&
vbp_mtx
);
...
...
bin/varnishd/cache/cache_tcp_pool.c
View file @
2f6eaf09
...
...
@@ -58,7 +58,7 @@ struct pfd {
#define PFD_MAGIC 0x0c5e6593
int
fd
;
VTAILQ_ENTRY
(
pfd
)
list
;
const
void
*
priv
;
VCL_IP
addr
;
uint8_t
state
;
struct
waited
waited
[
1
];
struct
conn_pool
*
conn_pool
;
...
...
@@ -69,8 +69,7 @@ struct pfd {
/*--------------------------------------------------------------------
*/
typedef
int
cp_open_f
(
const
struct
conn_pool
*
,
vtim_dur
tmo
,
const
void
**
privp
);
typedef
int
cp_open_f
(
const
struct
conn_pool
*
,
vtim_dur
tmo
,
VCL_IP
*
ap
);
typedef
void
cp_close_f
(
struct
pfd
*
);
typedef
void
cp_name_f
(
const
struct
pfd
*
,
char
*
,
unsigned
,
char
*
,
unsigned
);
...
...
@@ -374,7 +373,7 @@ VCP_Recycle(const struct worker *wrk, struct pfd **pfdp)
*/
static
int
VCP_Open
(
struct
conn_pool
*
cp
,
vtim_dur
tmo
,
const
void
**
priv
p
,
int
*
err
)
VCP_Open
(
struct
conn_pool
*
cp
,
vtim_dur
tmo
,
VCL_IP
*
a
p
,
int
*
err
)
{
int
r
;
vtim_mono
h
;
...
...
@@ -401,7 +400,7 @@ VCP_Open(struct conn_pool *cp, vtim_dur tmo, const void **privp, int *err)
return
(
-
1
);
}
r
=
cp
->
methods
->
open
(
cp
,
tmo
,
priv
p
);
r
=
cp
->
methods
->
open
(
cp
,
tmo
,
a
p
);
*
err
=
errno
;
...
...
@@ -518,7 +517,7 @@ VCP_Get(struct conn_pool *cp, vtim_dur tmo, struct worker *wrk,
INIT_OBJ
(
pfd
->
waited
,
WAITED_MAGIC
);
pfd
->
state
=
PFD_STATE_USED
;
pfd
->
conn_pool
=
cp
;
pfd
->
fd
=
VCP_Open
(
cp
,
tmo
,
&
pfd
->
priv
,
err
);
pfd
->
fd
=
VCP_Open
(
cp
,
tmo
,
&
pfd
->
addr
,
err
);
if
(
pfd
->
fd
<
0
)
{
FREE_OBJ
(
pfd
);
Lck_Lock
(
&
cp
->
mtx
);
...
...
@@ -572,7 +571,7 @@ tmo2msec(vtim_dur tmo)
}
static
int
v_matchproto_
(
cp_open_f
)
vtp_open
(
const
struct
conn_pool
*
cp
,
vtim_dur
tmo
,
const
void
**
priv
p
)
vtp_open
(
const
struct
conn_pool
*
cp
,
vtim_dur
tmo
,
VCL_IP
*
a
p
)
{
int
s
;
int
msec
;
...
...
@@ -583,17 +582,17 @@ vtp_open(const struct conn_pool *cp, vtim_dur tmo, const void **privp)
msec
=
tmo2msec
(
tmo
);
if
(
cache_param
->
prefer_ipv6
)
{
*
priv
p
=
tp
->
ip6
;
*
a
p
=
tp
->
ip6
;
s
=
VTCP_connect
(
tp
->
ip6
,
msec
);
if
(
s
>=
0
)
return
(
s
);
}
*
priv
p
=
tp
->
ip4
;
*
a
p
=
tp
->
ip4
;
s
=
VTCP_connect
(
tp
->
ip4
,
msec
);
if
(
s
>=
0
)
return
(
s
);
if
(
!
cache_param
->
prefer_ipv6
)
{
*
priv
p
=
tp
->
ip6
;
*
a
p
=
tp
->
ip6
;
s
=
VTCP_connect
(
tp
->
ip6
,
msec
);
}
return
(
s
);
...
...
@@ -634,7 +633,7 @@ static const struct cp_methods vtp_methods = {
*/
static
int
v_matchproto_
(
cp_open_f
)
vus_open
(
const
struct
conn_pool
*
cp
,
vtim_dur
tmo
,
const
void
**
priv
p
)
vus_open
(
const
struct
conn_pool
*
cp
,
vtim_dur
tmo
,
VCL_IP
*
a
p
)
{
int
s
;
int
msec
;
...
...
@@ -645,7 +644,7 @@ vus_open(const struct conn_pool *cp, vtim_dur tmo, const void **privp)
AN
(
tp
->
uds
);
msec
=
tmo2msec
(
tmo
);
*
priv
p
=
bogo_ip
;
*
a
p
=
bogo_ip
;
s
=
VUS_connect
(
tp
->
uds
,
msec
);
return
(
s
);
}
...
...
@@ -766,9 +765,9 @@ VTP_Rel(struct tcp_pool **tpp)
*/
int
VTP_Open
(
struct
tcp_pool
*
tp
,
vtim_dur
tmo
,
const
void
**
priv
p
,
int
*
err
)
VTP_Open
(
struct
tcp_pool
*
tp
,
vtim_dur
tmo
,
VCL_IP
*
a
p
,
int
*
err
)
{
return
(
VCP_Open
(
tp
->
cp
,
tmo
,
priv
p
,
err
));
return
(
VCP_Open
(
tp
->
cp
,
tmo
,
a
p
,
err
));
}
/*--------------------------------------------------------------------
...
...
@@ -817,14 +816,12 @@ VTP_Wait(struct worker *wrk, struct pfd *pfd, vtim_real tmo)
/*--------------------------------------------------------------------
*/
const
struct
suckaddr
*
VTP_
geti
p
(
struct
pfd
*
pfd
)
VCL_IP
VTP_
GetI
p
(
struct
pfd
*
pfd
)
{
struct
tcp_pool
*
tp
;
CHECK_OBJ_NOTNULL
(
pfd
,
PFD_MAGIC
);
CAST_OBJ_NOTNULL
(
tp
,
pfd
->
conn_pool
->
priv
,
TCP_POOL_MAGIC
);
return
(
pfd
->
priv
);
return
(
pfd
->
addr
);
}
/*--------------------------------------------------------------------*/
...
...
bin/varnishd/cache/cache_tcp_pool.h
View file @
2f6eaf09
...
...
@@ -73,7 +73,7 @@ void VTP_Rel(struct tcp_pool **);
* the pool is destroyed and all cached connections closed.
*/
int
VTP_Open
(
struct
tcp_pool
*
,
vtim_dur
tmo
,
const
void
*
*
,
int
*
);
int
VTP_Open
(
struct
tcp_pool
*
,
vtim_dur
tmo
,
VCL_IP
*
,
int
*
);
/*
* Open a new connection and return the address used.
* errno will be returned in the last argument.
...
...
@@ -104,5 +104,5 @@ int VTP_Wait(struct worker *, struct pfd *, vtim_real tmo);
void
VTP_panic
(
struct
vsb
*
,
struct
tcp_pool
*
);
const
struct
suckaddr
*
VTP_geti
p
(
struct
pfd
*
);
VCL_IP
VTP_GetI
p
(
struct
pfd
*
);
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