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
63cdbd33
Commit
63cdbd33
authored
Mar 23, 2021
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Detect varnishd startup failure, for instance param trouble, right away.
parent
784756e0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
14 deletions
+13
-14
vtc_varnish.c
bin/varnishtest/vtc_varnish.c
+13
-14
No files found.
bin/varnishtest/vtc_varnish.c
View file @
63cdbd33
...
@@ -327,7 +327,6 @@ varnish_new(const char *name)
...
@@ -327,7 +327,6 @@ varnish_new(const char *name)
v
->
cli_fd
=
-
1
;
v
->
cli_fd
=
-
1
;
VTAILQ_INSERT_TAIL
(
&
varnishes
,
v
,
list
);
VTAILQ_INSERT_TAIL
(
&
varnishes
,
v
,
list
);
return
(
v
);
return
(
v
);
}
}
...
@@ -384,19 +383,19 @@ static void
...
@@ -384,19 +383,19 @@ static void
varnish_launch
(
struct
varnish
*
v
)
varnish_launch
(
struct
varnish
*
v
)
{
{
struct
vsb
*
vsb
,
*
vsb1
;
struct
vsb
*
vsb
,
*
vsb1
;
int
i
,
nfd
;
int
i
,
nfd
,
asock
;
char
abuf
[
128
],
pbuf
[
128
];
char
abuf
[
128
],
pbuf
[
128
];
struct
pollfd
fd
[
2
];
struct
pollfd
fd
[
3
];
enum
VCLI_status_e
u
;
enum
VCLI_status_e
u
;
const
char
*
err
;
const
char
*
err
;
char
*
r
=
NULL
;
char
*
r
=
NULL
;
/* Create listener socket */
/* Create listener socket */
v
->
cli_fd
=
VTCP_listen_on
(
default_listen_addr
,
NULL
,
1
,
&
err
);
asock
=
VTCP_listen_on
(
default_listen_addr
,
NULL
,
1
,
&
err
);
if
(
err
!=
NULL
)
if
(
err
!=
NULL
)
vtc_fatal
(
v
->
vl
,
"Create CLI listen socket failed: %s"
,
err
);
vtc_fatal
(
v
->
vl
,
"Create CLI listen socket failed: %s"
,
err
);
assert
(
v
->
cli_fd
>
0
);
assert
(
asock
>
0
);
VTCP_myname
(
v
->
cli_fd
,
abuf
,
sizeof
abuf
,
pbuf
,
sizeof
pbuf
);
VTCP_myname
(
asock
,
abuf
,
sizeof
abuf
,
pbuf
,
sizeof
pbuf
);
AZ
(
VSB_finish
(
v
->
args
));
AZ
(
VSB_finish
(
v
->
args
));
vtc_log
(
v
->
vl
,
2
,
"Launch"
);
vtc_log
(
v
->
vl
,
2
,
"Launch"
);
...
@@ -465,26 +464,26 @@ varnish_launch(struct varnish *v)
...
@@ -465,26 +464,26 @@ varnish_launch(struct varnish *v)
/* Wait for the varnish to call home */
/* Wait for the varnish to call home */
memset
(
fd
,
0
,
sizeof
fd
);
memset
(
fd
,
0
,
sizeof
fd
);
fd
[
0
].
fd
=
v
->
cli_fd
;
fd
[
0
].
fd
=
asock
;
fd
[
0
].
events
=
POLLIN
;
fd
[
0
].
events
=
POLLIN
;
fd
[
1
].
fd
=
v
->
fds
[
1
];
fd
[
1
].
fd
=
v
->
fds
[
1
];
fd
[
1
].
events
=
POLLIN
;
fd
[
1
].
events
=
POLLIN
;
fd
[
2
].
fd
=
v
->
fds
[
2
];
fd
[
2
].
events
=
POLLIN
;
i
=
poll
(
fd
,
2
,
vtc_maxdur
*
1000
/
3
);
i
=
poll
(
fd
,
2
,
vtc_maxdur
*
1000
/
3
);
vtc_log
(
v
->
vl
,
4
,
"CLIPOLL %d 0x%x 0x%x"
,
vtc_log
(
v
->
vl
,
4
,
"CLIPOLL %d 0x%x 0x%x
0x%x
"
,
i
,
fd
[
0
].
revents
,
fd
[
1
].
revents
);
i
,
fd
[
0
].
revents
,
fd
[
1
].
revents
,
fd
[
2
].
revents
);
if
(
i
==
0
)
if
(
i
==
0
)
vtc_fatal
(
v
->
vl
,
"FAIL timeout waiting for CLI connection"
);
vtc_fatal
(
v
->
vl
,
"FAIL timeout waiting for CLI connection"
);
if
(
fd
[
1
].
revents
&
POLLHUP
)
if
(
fd
[
1
].
revents
&
POLLHUP
)
vtc_fatal
(
v
->
vl
,
"FAIL debug pipe closed"
);
vtc_fatal
(
v
->
vl
,
"FAIL debug pipe closed"
);
if
(
!
(
fd
[
0
].
revents
&
POLLIN
))
if
(
!
(
fd
[
0
].
revents
&
POLLIN
))
vtc_fatal
(
v
->
vl
,
"FAIL CLI connection wait failure"
);
vtc_fatal
(
v
->
vl
,
"FAIL CLI connection wait failure"
);
nfd
=
accept
(
v
->
cli_fd
,
NULL
,
NULL
);
nfd
=
accept
(
asock
,
NULL
,
NULL
);
if
(
nfd
<
0
)
{
closefd
(
&
asock
);
closefd
(
&
v
->
cli_fd
);
if
(
nfd
<
0
)
vtc_fatal
(
v
->
vl
,
"FAIL no CLI connection accepted"
);
vtc_fatal
(
v
->
vl
,
"FAIL no CLI connection accepted"
);
}
closefd
(
&
v
->
cli_fd
);
v
->
cli_fd
=
nfd
;
v
->
cli_fd
=
nfd
;
vtc_log
(
v
->
vl
,
3
,
"CLI connection fd = %d"
,
v
->
cli_fd
);
vtc_log
(
v
->
vl
,
3
,
"CLI connection fd = %d"
,
v
->
cli_fd
);
...
...
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