Skip to content

Commit

Permalink
code quality
Browse files Browse the repository at this point in the history
  • Loading branch information
icebob committed Nov 25, 2023
1 parent 4f4f6d7 commit 509233a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/transporters/tcp.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,16 @@ class TcpTransporter extends Transporter {
if (s.startsWith("tcp://")) s = s.replace("tcp://", "");

const p = s.split("/");
if (p.length != 2)
return this.logger.warn(
"Invalid endpoint URL. Missing nodeID. URL:",
s
);
if (p.length != 2) {
this.logger.warn("Invalid endpoint URL. Missing nodeID. URL:", s);
return;
}

const u = p[0].split(":");
if (u.length < 2)
return this.logger.warn("Invalid endpoint URL. Missing port. URL:", s);
if (u.length < 2) {
this.logger.warn("Invalid endpoint URL. Missing port. URL:", s);
return;
}

const nodeID = p[1];
const port = Number(u.pop());
Expand Down

0 comments on commit 509233a

Please sign in to comment.