tls: simplify enableTrace logic

PR-URL: https://github.com/nodejs/node/pull/27497
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
cjihrig 2019-04-30 10:59:10 -04:00
parent ee3b4fd5b2
commit b233d028b3
No known key found for this signature in database
GPG Key ID: 7434390BDBE9B9C5

View File

@ -998,13 +998,12 @@ function Server(options, listener) {
}
const enableTrace = options.enableTrace;
if (enableTrace === true)
this[kEnableTrace] = true;
else if (enableTrace === false || enableTrace == null)
; // Tracing explicitly disabled, or defaulting to disabled.
else
if (typeof enableTrace === 'boolean') {
this[kEnableTrace] = enableTrace;
} else if (enableTrace != null) {
throw new ERR_INVALID_ARG_TYPE(
'options.enableTrace', 'boolean', enableTrace);
}
}
Object.setPrototypeOf(Server.prototype, net.Server.prototype);