From 8ccf29be4670e07dd059eca10f6b34fa426697cf Mon Sep 17 00:00:00 2001 From: Brandon Nozaki Miller Date: Sun, 31 Aug 2014 10:50:34 -0700 Subject: [PATCH] added support for infinate retries --- example/unixSocket/basic/hello-client.js | 3 ++- lib/client.js | 12 +++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/example/unixSocket/basic/hello-client.js b/example/unixSocket/basic/hello-client.js index 15f67f0..57306c4 100644 --- a/example/unixSocket/basic/hello-client.js +++ b/example/unixSocket/basic/hello-client.js @@ -8,7 +8,8 @@ var ipc=require('../../../node-ipc'); * *************************************/ ipc.config.id = 'hello'; -ipc.config.retry= 1500; +ipc.config.maxRetries = 10; +ipc.config.retry = 100; ipc.connectTo( 'world', diff --git a/lib/client.js b/lib/client.js index c67b477..8fae5ff 100644 --- a/lib/client.js +++ b/lib/client.js @@ -81,10 +81,12 @@ function connect(){ client.log('connection closed'.notice ,client.id.variable , client.path.variable); if(client.stopRetrying || client.retriesRemaining<1){ - client.log(client.config.id.variable,'exceeded connection rety amount of'.warn,client.config.stopRetrying, " or stopRetrying flag set."); - client.socket.destroy(); - client=undefined; - return; + if(client.config.maxRetries){ + client.log(client.config.id.variable,'exceeded connection rety amount of'.warn,client.config.stopRetrying, " or stopRetrying flag set."); + client.socket.destroy(); + client=undefined; + return; + } } client.isRetrying=true; @@ -99,7 +101,7 @@ function connect(){ setTimeout( function(){ if(!client.isRetrying) - client.retriesRemaining=ipc.config.maxRetries; + client.retriesRemaining=client.config.maxRetries; }, 100 )