net: shallow copy option when create Server

PR-URL: https://github.com/nodejs/node/pull/28924
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Masashi Hirano <shisama07@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
himself65 2019-08-01 16:12:57 +08:00 committed by Rich Trott
parent aa252ebf66
commit d53035488c

View File

@ -1078,7 +1078,7 @@ function Server(options, connectionListener) {
options = {};
this.on('connection', connectionListener);
} else if (options == null || typeof options === 'object') {
options = options || {};
options = { ...options };
if (typeof connectionListener === 'function') {
this.on('connection', connectionListener);