Skip to content

Commit

Permalink
Set the timer only for non-zero timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Stimming committed Oct 30, 2020
1 parent 2eddb65 commit 6b61e12
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dcom/transport/comtransport.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class ComTransport extends events.EventEmitter
}
});

const connectFailedTimer = setTimeout(() =>
const connectFailedTimer = self.timeout && setTimeout(() =>
channel.emit('error', 'Connection could not be established'), self.timeout)
channel.connect(Number.parseInt(self.port), self.host, () => {
clearTimeout(connectFailedTimer)
Expand Down

0 comments on commit 6b61e12

Please sign in to comment.