mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05:00
fix: listenTlsWithReuseAddr test (#16420)
This commit is contained in:
parent
ffff814540
commit
1f6aeb430b
1 changed files with 11 additions and 28 deletions
|
@ -1378,7 +1378,7 @@ Deno.test(
|
||||||
);
|
);
|
||||||
|
|
||||||
Deno.test(
|
Deno.test(
|
||||||
{ permissions: { read: false, net: true } },
|
{ permissions: { net: true } },
|
||||||
async function listenTlsWithReuseAddr() {
|
async function listenTlsWithReuseAddr() {
|
||||||
const resolvable1 = deferred();
|
const resolvable1 = deferred();
|
||||||
const hostname = "localhost";
|
const hostname = "localhost";
|
||||||
|
@ -1386,44 +1386,27 @@ Deno.test(
|
||||||
|
|
||||||
const listener1 = Deno.listenTls({ hostname, port, cert, key });
|
const listener1 = Deno.listenTls({ hostname, port, cert, key });
|
||||||
|
|
||||||
const response1 = encoder.encode(
|
listener1.accept().then((conn) => {
|
||||||
"HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\nHello World\n",
|
conn.close();
|
||||||
);
|
resolvable1.resolve();
|
||||||
|
});
|
||||||
listener1.accept().then(
|
|
||||||
async (conn) => {
|
|
||||||
await conn.write(response1);
|
|
||||||
setTimeout(() => {
|
|
||||||
conn.close();
|
|
||||||
resolvable1.resolve();
|
|
||||||
}, 0);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
const conn1 = await Deno.connectTls({ hostname, port, caCerts });
|
const conn1 = await Deno.connectTls({ hostname, port, caCerts });
|
||||||
conn1.close();
|
conn1.close();
|
||||||
listener1.close();
|
|
||||||
await resolvable1;
|
await resolvable1;
|
||||||
|
listener1.close();
|
||||||
|
|
||||||
const resolvable2 = deferred();
|
const resolvable2 = deferred();
|
||||||
const listener2 = Deno.listenTls({ hostname, port, cert, key });
|
const listener2 = Deno.listenTls({ hostname, port, cert, key });
|
||||||
const response2 = encoder.encode(
|
|
||||||
"HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\nHello World\n",
|
|
||||||
);
|
|
||||||
|
|
||||||
listener2.accept().then(
|
listener2.accept().then((conn) => {
|
||||||
async (conn) => {
|
conn.close();
|
||||||
await conn.write(response2);
|
resolvable2.resolve();
|
||||||
setTimeout(() => {
|
});
|
||||||
conn.close();
|
|
||||||
resolvable2.resolve();
|
|
||||||
}, 0);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
const conn2 = await Deno.connectTls({ hostname, port, caCerts });
|
const conn2 = await Deno.connectTls({ hostname, port, caCerts });
|
||||||
conn2.close();
|
conn2.close();
|
||||||
listener2.close();
|
|
||||||
await resolvable2;
|
await resolvable2;
|
||||||
|
listener2.close();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue