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
d4455ed4
Commit
d4455ed4
authored
Sep 20, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correctly handle listen socket shutdown: Delete the poolsock instance,
pretend nothing else happened.
parent
e749a3ee
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
cache_acceptor.c
bin/varnishd/cache_acceptor.c
+0
-1
cache_pool.c
bin/varnishd/cache_pool.c
+14
-4
No files found.
bin/varnishd/cache_acceptor.c
View file @
d4455ed4
...
@@ -212,7 +212,6 @@ VCA_Accept(struct listen_sock *ls, struct wrk_accept *wa)
...
@@ -212,7 +212,6 @@ VCA_Accept(struct listen_sock *ls, struct wrk_accept *wa)
int
i
;
int
i
;
CHECK_OBJ_NOTNULL
(
ls
,
LISTEN_SOCK_MAGIC
);
CHECK_OBJ_NOTNULL
(
ls
,
LISTEN_SOCK_MAGIC
);
assert
(
ls
->
sock
>=
0
);
vca_pace_check
();
vca_pace_check
();
while
(
!
hack_ready
)
while
(
!
hack_ready
)
...
...
bin/varnishd/cache_pool.c
View file @
d4455ed4
...
@@ -137,7 +137,7 @@ static pthread_t thr_pool_herder;
...
@@ -137,7 +137,7 @@ static pthread_t thr_pool_herder;
* for a brief moment and it takes up around 144 bytes.
* for a brief moment and it takes up around 144 bytes.
*/
*/
static
void
static
int
pool_accept
(
struct
pool
*
pp
,
struct
worker
*
w
,
const
struct
poolsock
*
ps
)
pool_accept
(
struct
pool
*
pp
,
struct
worker
*
w
,
const
struct
poolsock
*
ps
)
{
{
struct
worker
*
w2
;
struct
worker
*
w2
;
...
@@ -156,6 +156,11 @@ pool_accept(struct pool *pp, struct worker *w, const struct poolsock *ps)
...
@@ -156,6 +156,11 @@ pool_accept(struct pool *pp, struct worker *w, const struct poolsock *ps)
memset
(
wa
,
0
,
sizeof
*
wa
);
memset
(
wa
,
0
,
sizeof
*
wa
);
wa
->
magic
=
WRK_ACCEPT_MAGIC
;
wa
->
magic
=
WRK_ACCEPT_MAGIC
;
if
(
ps
->
lsock
->
sock
<
0
)
{
/* Socket Shutdown */
Lck_Lock
(
&
pp
->
mtx
);
return
(
-
1
);
}
if
(
VCA_Accept
(
ps
->
lsock
,
wa
)
<
0
)
{
if
(
VCA_Accept
(
ps
->
lsock
,
wa
)
<
0
)
{
w
->
stats
.
sess_fail
++
;
w
->
stats
.
sess_fail
++
;
/* We're going to pace in vca anyway... */
/* We're going to pace in vca anyway... */
...
@@ -165,7 +170,7 @@ pool_accept(struct pool *pp, struct worker *w, const struct poolsock *ps)
...
@@ -165,7 +170,7 @@ pool_accept(struct pool *pp, struct worker *w, const struct poolsock *ps)
Lck_Lock
(
&
pp
->
mtx
);
Lck_Lock
(
&
pp
->
mtx
);
if
(
VTAILQ_EMPTY
(
&
pp
->
idle
))
if
(
VTAILQ_EMPTY
(
&
pp
->
idle
))
return
;
return
(
0
)
;
w2
=
VTAILQ_FIRST
(
&
pp
->
idle
);
w2
=
VTAILQ_FIRST
(
&
pp
->
idle
);
VTAILQ_REMOVE
(
&
pp
->
idle
,
w2
,
list
);
VTAILQ_REMOVE
(
&
pp
->
idle
,
w2
,
list
);
Lck_Unlock
(
&
pp
->
mtx
);
Lck_Unlock
(
&
pp
->
mtx
);
...
@@ -184,7 +189,7 @@ void
...
@@ -184,7 +189,7 @@ void
Pool_Work_Thread
(
void
*
priv
,
struct
worker
*
w
)
Pool_Work_Thread
(
void
*
priv
,
struct
worker
*
w
)
{
{
struct
pool
*
pp
;
struct
pool
*
pp
;
int
stats_clean
;
int
stats_clean
,
i
;
struct
poolsock
*
ps
;
struct
poolsock
*
ps
;
CAST_OBJ_NOTNULL
(
pp
,
priv
,
POOL_MAGIC
);
CAST_OBJ_NOTNULL
(
pp
,
priv
,
POOL_MAGIC
);
...
@@ -212,8 +217,13 @@ Pool_Work_Thread(void *priv, struct worker *w)
...
@@ -212,8 +217,13 @@ Pool_Work_Thread(void *priv, struct worker *w)
/* Accept on a socket */
/* Accept on a socket */
ps
=
VTAILQ_FIRST
(
&
pp
->
socks
);
ps
=
VTAILQ_FIRST
(
&
pp
->
socks
);
VTAILQ_REMOVE
(
&
pp
->
socks
,
ps
,
list
);
VTAILQ_REMOVE
(
&
pp
->
socks
,
ps
,
list
);
pool_accept
(
pp
,
w
,
ps
);
i
=
pool_accept
(
pp
,
w
,
ps
);
Lck_AssertHeld
(
&
pp
->
mtx
);
Lck_AssertHeld
(
&
pp
->
mtx
);
if
(
i
<
0
)
{
/* Socket Shutdown */
FREE_OBJ
(
ps
);
continue
;
}
VTAILQ_INSERT_TAIL
(
&
pp
->
socks
,
ps
,
list
);
VTAILQ_INSERT_TAIL
(
&
pp
->
socks
,
ps
,
list
);
}
else
if
(
VTAILQ_EMPTY
(
&
pp
->
socks
))
{
}
else
if
(
VTAILQ_EMPTY
(
&
pp
->
socks
))
{
/* Nothing to do: To sleep, perchance to dream ... */
/* Nothing to do: To sleep, perchance to dream ... */
...
...
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