https: server add asyncDispose

PR-URL: https://github.com/nodejs/node/pull/48548
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
atlowChemi
2023-06-25 23:29:58 +03:00
committed by Moshe Atlow
parent b7bfb17bef
commit e8810b91f1
3 changed files with 37 additions and 0 deletions

View File

@@ -33,11 +33,13 @@ const {
ObjectSetPrototypeOf,
ReflectApply,
ReflectConstruct,
SymbolAsyncDispose,
} = primordials;
const {
assertCrypto,
kEmptyObject,
promisify,
} = require('internal/util');
assertCrypto();
@@ -110,6 +112,10 @@ Server.prototype.close = function() {
ReflectApply(tls.Server.prototype.close, this, arguments);
};
Server.prototype[SymbolAsyncDispose] = async function() {
return FunctionPrototypeCall(promisify(this.close), this);
};
/**
* Creates a new `https.Server` instance.
* @param {{