Commit c888c08d authored by Poul-Henning Kamp's avatar Poul-Henning Kamp Committed by Tollef Fog Heen

Try harder to make v00036 deterministic

parent ea964eb0
......@@ -4,22 +4,25 @@ server s1 {
rxreq
expect req.url == "/"
txresp -body "slash"
accept
close
sema r1 sync 3
accept
rxreq
expect req.url == "/"
txresp -body "slash"
accept
close
accept
rxreq
expect req.url == "/"
txresp -body "slash"
close
sema r3 sync 2
accept
accept
rxreq
expect req.url == "/foo"
txresp -hdr "Foo: 1" -body "foobar"
......@@ -30,17 +33,19 @@ server s2 {
rxreq
expect req.url == "/"
txresp -body "slash"
accept
close
sema r1 sync 3
accept
rxreq
expect req.url == "/"
txresp -body "slash"
close
sema r2 sync 2
accept
accept
rxreq
expect req.url == "/foo"
txresp -hdr "Foo: 2" -body "foobar"
......
......@@ -1058,6 +1058,25 @@ cmd_http_expect_close(CMD_ARGS)
vtc_log(vl, 4, "fd=%d EOF, as expected", hp->fd);
}
/**********************************************************************
* close a new connection (server only)
*/
static void
cmd_http_close(CMD_ARGS)
{
struct http *hp;
(void)cmd;
(void)vl;
CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
AZ(av[1]);
assert(hp->sfd != NULL);
assert(*hp->sfd >= 0);
VTCP_close(&hp->fd);
vtc_log(vl, 4, "Closed");
}
/**********************************************************************
* close and accept a new connection (server only)
*/
......@@ -1073,7 +1092,8 @@ cmd_http_accept(CMD_ARGS)
AZ(av[1]);
assert(hp->sfd != NULL);
assert(*hp->sfd >= 0);
VTCP_close(&hp->fd);
if (hp->fd >= 0)
VTCP_close(&hp->fd);
vtc_log(vl, 4, "Accepting");
hp->fd = accept(*hp->sfd, NULL, NULL);
if (hp->fd < 0)
......@@ -1129,6 +1149,7 @@ static const struct cmds http_cmds[] = {
{ "delay", cmd_delay },
{ "sema", cmd_sema },
{ "expect_close", cmd_http_expect_close },
{ "close", cmd_http_close },
{ "accept", cmd_http_accept },
{ "loop", cmd_http_loop },
{ NULL, NULL }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment