Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
unique-xids
Commits
98f1c8c7
Commit
98f1c8c7
authored
Oct 06, 2011
by
Poul-Henning Kamp
Committed by
Tollef Fog Heen
Feb 24, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a "wait-running" primitive to varnish instances, so we can
avoid fixed sleeps waiting for the child process to start.
parent
5e46b7c0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
2 deletions
+33
-2
v00010.vtc
bin/varnishtest/tests/v00010.vtc
+4
-2
vtc_varnish.c
bin/varnishtest/vtc_varnish.c
+29
-0
No files found.
bin/varnishtest/tests/v00010.vtc
View file @
98f1c8c7
...
...
@@ -5,6 +5,8 @@ server s1 {
txresp -hdr "Foo: bar" -body "abcdef\n"
rxreq
txresp -hdr "Panic: please" -body "012345\n"
close
sema r1 sync 2
accept
rxreq
...
...
@@ -33,10 +35,10 @@ client c1 {
rxresp
txreq -url "/foo"
# Don't expect answer, the server crashed.
sema r1 sync 2
} -run
delay 2.5
varnish v1 -wait-running
sema r1 sync 2
client c1 {
txreq -url "/"
...
...
bin/varnishtest/vtc_varnish.c
View file @
98f1c8c7
...
...
@@ -119,6 +119,30 @@ varnish_ask_cli(const struct varnish *v, const char *cmd, char **repl)
return
((
enum
VCLI_status_e
)
retval
);
}
/**********************************************************************
*
*/
static
void
wait_running
(
const
struct
varnish
*
v
)
{
char
*
r
;
enum
VCLI_status_e
st
;
while
(
1
)
{
st
=
varnish_ask_cli
(
v
,
"status"
,
&
r
);
if
(
st
!=
CLIS_OK
)
vtc_log
(
v
->
vl
,
0
,
"CLI status command failed: %u %s"
,
st
,
r
);
if
(
!
strcmp
(
r
,
"Child in state running"
))
{
free
(
r
);
break
;
}
free
(
r
);
(
void
)
usleep
(
200000
);
}
}
/**********************************************************************
* Varnishlog gatherer + thread
*/
...
...
@@ -431,6 +455,7 @@ varnish_start(struct varnish *v)
return
;
if
(
u
!=
CLIS_OK
)
vtc_log
(
v
->
vl
,
0
,
"CLI start command failed: %u %s"
,
u
,
resp
);
wait_running
(
v
);
free
(
resp
);
u
=
varnish_ask_cli
(
v
,
"debug.xid 1000"
,
&
resp
);
if
(
vtc_error
)
...
...
@@ -815,6 +840,10 @@ cmd_varnish(CMD_ARGS)
varnish_stop
(
v
);
continue
;
}
if
(
!
strcmp
(
*
av
,
"-wait-running"
))
{
wait_running
(
v
);
continue
;
}
if
(
!
strcmp
(
*
av
,
"-wait"
))
{
varnish_wait
(
v
);
continue
;
...
...
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