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
7d6566e7
Commit
7d6566e7
authored
Jul 16, 2018
by
Geoff Simmons
Committed by
Dridi Boukelmoune
Aug 16, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set socket options correctly for the accepted socket.
Closes #2722
parent
dd5ea4a2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
12 deletions
+10
-12
cache_acceptor.c
bin/varnishd/cache/cache_acceptor.c
+10
-12
No files found.
bin/varnishd/cache/cache_acceptor.c
View file @
7d6566e7
...
@@ -221,17 +221,16 @@ vca_tcp_opt_init(void)
...
@@ -221,17 +221,16 @@ vca_tcp_opt_init(void)
}
}
static
void
static
void
vca_tcp_opt_test
(
const
struct
listen_sock
*
l
s
)
vca_tcp_opt_test
(
const
int
sock
,
const
unsigned
ud
s
)
{
{
int
i
,
n
,
sock
;
int
i
,
n
;
struct
tcp_opt
*
to
;
struct
tcp_opt
*
to
;
socklen_t
l
;
socklen_t
l
;
void
*
ptr
;
void
*
ptr
;
sock
=
ls
->
sock
;
for
(
n
=
0
;
n
<
n_tcp_opts
;
n
++
)
{
for
(
n
=
0
;
n
<
n_tcp_opts
;
n
++
)
{
to
=
&
tcp_opts
[
n
];
to
=
&
tcp_opts
[
n
];
if
(
to
->
iponly
&&
ls
->
uds
)
if
(
to
->
iponly
&&
uds
)
continue
;
continue
;
to
->
need
=
1
;
to
->
need
=
1
;
ptr
=
calloc
(
1
,
to
->
sz
);
ptr
=
calloc
(
1
,
to
->
sz
);
...
@@ -247,15 +246,14 @@ vca_tcp_opt_test(const struct listen_sock *ls)
...
@@ -247,15 +246,14 @@ vca_tcp_opt_test(const struct listen_sock *ls)
}
}
static
void
static
void
vca_tcp_opt_set
(
const
struct
listen_sock
*
ls
,
int
force
)
vca_tcp_opt_set
(
const
int
sock
,
const
unsigned
uds
,
const
int
force
)
{
{
int
n
,
sock
;
int
n
;
struct
tcp_opt
*
to
;
struct
tcp_opt
*
to
;
sock
=
ls
->
sock
;
for
(
n
=
0
;
n
<
n_tcp_opts
;
n
++
)
{
for
(
n
=
0
;
n
<
n_tcp_opts
;
n
++
)
{
to
=
&
tcp_opts
[
n
];
to
=
&
tcp_opts
[
n
];
if
(
to
->
iponly
&&
ls
->
uds
)
if
(
to
->
iponly
&&
uds
)
continue
;
continue
;
if
(
to
->
need
||
force
)
{
if
(
to
->
need
||
force
)
{
VTCP_Assert
(
setsockopt
(
sock
,
VTCP_Assert
(
setsockopt
(
sock
,
...
@@ -426,10 +424,10 @@ vca_make_session(struct worker *wrk, void *arg)
...
@@ -426,10 +424,10 @@ vca_make_session(struct worker *wrk, void *arg)
wrk
->
stats
->
sess_conn
++
;
wrk
->
stats
->
sess_conn
++
;
if
(
need_test
)
{
if
(
need_test
)
{
vca_tcp_opt_test
(
wa
->
acceptlsock
);
vca_tcp_opt_test
(
sp
->
fd
,
wa
->
acceptlsock
->
uds
);
need_test
=
0
;
need_test
=
0
;
}
}
vca_tcp_opt_set
(
wa
->
acceptlsock
,
0
);
vca_tcp_opt_set
(
sp
->
fd
,
wa
->
acceptlsock
->
uds
,
0
);
req
=
Req_New
(
wrk
,
sp
);
req
=
Req_New
(
wrk
,
sp
);
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
...
@@ -607,7 +605,7 @@ vca_acct(void *arg)
...
@@ -607,7 +605,7 @@ vca_acct(void *arg)
if
(
ls
->
sock
==
-
2
)
if
(
ls
->
sock
==
-
2
)
continue
;
// VCA_Shutdown
continue
;
// VCA_Shutdown
assert
(
ls
->
sock
>
0
);
assert
(
ls
->
sock
>
0
);
vca_tcp_opt_set
(
ls
,
1
);
vca_tcp_opt_set
(
ls
->
sock
,
ls
->
uds
,
1
);
}
}
AZ
(
pthread_mutex_unlock
(
&
shut_mtx
));
AZ
(
pthread_mutex_unlock
(
&
shut_mtx
));
}
}
...
@@ -646,7 +644,7 @@ ccf_start(struct cli *cli, const char * const *av, void *priv)
...
@@ -646,7 +644,7 @@ ccf_start(struct cli *cli, const char * const *av, void *priv)
ls
->
endpoint
,
strerror
(
errno
));
ls
->
endpoint
,
strerror
(
errno
));
return
;
return
;
}
}
vca_tcp_opt_set
(
ls
,
1
);
vca_tcp_opt_set
(
ls
->
sock
,
ls
->
uds
,
1
);
if
(
cache_param
->
accept_filter
)
{
if
(
cache_param
->
accept_filter
)
{
int
i
;
int
i
;
i
=
VTCP_filter_http
(
ls
->
sock
);
i
=
VTCP_filter_http
(
ls
->
sock
);
...
...
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