added support for infinate retries
This commit is contained in:
parent
5b9f13dfb6
commit
8ccf29be46
2 changed files with 9 additions and 6 deletions
|
@ -8,7 +8,8 @@ var ipc=require('../../../node-ipc');
|
||||||
* *************************************/
|
* *************************************/
|
||||||
|
|
||||||
ipc.config.id = 'hello';
|
ipc.config.id = 'hello';
|
||||||
ipc.config.retry= 1500;
|
ipc.config.maxRetries = 10;
|
||||||
|
ipc.config.retry = 100;
|
||||||
|
|
||||||
ipc.connectTo(
|
ipc.connectTo(
|
||||||
'world',
|
'world',
|
||||||
|
|
|
@ -81,11 +81,13 @@ function connect(){
|
||||||
client.log('connection closed'.notice ,client.id.variable , client.path.variable);
|
client.log('connection closed'.notice ,client.id.variable , client.path.variable);
|
||||||
|
|
||||||
if(client.stopRetrying || client.retriesRemaining<1){
|
if(client.stopRetrying || client.retriesRemaining<1){
|
||||||
|
if(client.config.maxRetries){
|
||||||
client.log(client.config.id.variable,'exceeded connection rety amount of'.warn,client.config.stopRetrying, " or stopRetrying flag set.");
|
client.log(client.config.id.variable,'exceeded connection rety amount of'.warn,client.config.stopRetrying, " or stopRetrying flag set.");
|
||||||
client.socket.destroy();
|
client.socket.destroy();
|
||||||
client=undefined;
|
client=undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
client.isRetrying=true;
|
client.isRetrying=true;
|
||||||
|
|
||||||
|
@ -99,7 +101,7 @@ function connect(){
|
||||||
setTimeout(
|
setTimeout(
|
||||||
function(){
|
function(){
|
||||||
if(!client.isRetrying)
|
if(!client.isRetrying)
|
||||||
client.retriesRemaining=ipc.config.maxRetries;
|
client.retriesRemaining=client.config.maxRetries;
|
||||||
},
|
},
|
||||||
100
|
100
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue