test: end tls gracefully, rather than destroy
The timing of destroy between client/server is undefined, but end is guaranteed to occur. PR-URL: https://github.com/nodejs/node/pull/25508 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
bca2e219a3
commit
1bd42833d7
@ -115,6 +115,7 @@ let clientError;
|
|||||||
|
|
||||||
const server = tls.createServer(serverOptions, function(c) {
|
const server = tls.createServer(serverOptions, function(c) {
|
||||||
serverResults.push({ sni: c.servername, authorized: c.authorized });
|
serverResults.push({ sni: c.servername, authorized: c.authorized });
|
||||||
|
c.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
server.on('tlsClientError', function(err) {
|
server.on('tlsClientError', function(err) {
|
||||||
@ -135,7 +136,6 @@ function startTest() {
|
|||||||
clientResults.push(
|
clientResults.push(
|
||||||
client.authorizationError &&
|
client.authorizationError &&
|
||||||
(client.authorizationError === 'ERR_TLS_CERT_ALTNAME_INVALID'));
|
(client.authorizationError === 'ERR_TLS_CERT_ALTNAME_INVALID'));
|
||||||
client.destroy();
|
|
||||||
|
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
@ -86,6 +86,7 @@ const clientResults = [];
|
|||||||
|
|
||||||
const server = tls.createServer(serverOptions, function(c) {
|
const server = tls.createServer(serverOptions, function(c) {
|
||||||
serverResults.push(c.servername);
|
serverResults.push(c.servername);
|
||||||
|
c.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
server.addContext('a.example.com', SNIContexts['a.example.com']);
|
server.addContext('a.example.com', SNIContexts['a.example.com']);
|
||||||
@ -107,7 +108,6 @@ function startTest() {
|
|||||||
clientResults.push(
|
clientResults.push(
|
||||||
client.authorizationError &&
|
client.authorizationError &&
|
||||||
(client.authorizationError === 'ERR_TLS_CERT_ALTNAME_INVALID'));
|
(client.authorizationError === 'ERR_TLS_CERT_ALTNAME_INVALID'));
|
||||||
client.destroy();
|
|
||||||
|
|
||||||
// Continue
|
// Continue
|
||||||
start();
|
start();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user