Skip to content

Commit

Permalink
cluster: removed unused addressType argument from constructor
Browse files Browse the repository at this point in the history
When intializing the constructor for cluster master we are heavily using
a generic structure, but the effect of passing arguments that are
related to shared_handle is that there is a stale argument passed.

We can avoid such scenarios as all the remaining entities are being
destructured from the message object.

PR-URL: #32963
Reviewed-By: David Carlier <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Andrey Pechkurov <[email protected]>
  • Loading branch information
yashLadha authored and BridgeAR committed Apr 28, 2020
1 parent 44a5b73 commit 98a2c67
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
7 changes: 1 addition & 6 deletions lib/internal/cluster/master.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,7 @@ function queryServer(worker, message) {
constructor = SharedHandle;
}

handle = new constructor(key,
address,
message.port,
message.addressType,
message.fd,
message.flags);
handle = new constructor(key, address, message);
handles.set(key, handle);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/internal/cluster/round_robin_handle.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const { constants } = internalBinding('tcp_wrap');

module.exports = RoundRobinHandle;

function RoundRobinHandle(key, address, port, addressType, fd, flags) {
function RoundRobinHandle(key, address, { port, fd, flags }) {
this.key = key;
this.all = new Map();
this.free = new Map();
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/cluster/shared_handle.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const net = require('net');

module.exports = SharedHandle;

function SharedHandle(key, address, port, addressType, fd, flags) {
function SharedHandle(key, address, { port, addressType, fd, flags }) {
this.key = key;
this.workers = new Map();
this.handle = null;
Expand Down

0 comments on commit 98a2c67

Please sign in to comment.