From 6b61e12fe2f1b021a191aa14716c97170e3af961 Mon Sep 17 00:00:00 2001 From: Christian Stimming Date: Fri, 30 Oct 2020 09:07:43 +0100 Subject: [PATCH] Set the timer only for non-zero timeouts --- dcom/transport/comtransport.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dcom/transport/comtransport.js b/dcom/transport/comtransport.js index 9b24ae1..471295a 100755 --- a/dcom/transport/comtransport.js +++ b/dcom/transport/comtransport.js @@ -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)