added 'explicitlyDisconnected' flag to Client object

this flag will be set to true when a 'ipc.disconnect' is called on the client to prevent the client from attempting to retry to connect
This commit is contained in:
Mostafa Samir 2016-04-04 00:30:44 +02:00
parent df0c6407c1
commit 90260d1d3d
1 changed files with 5 additions and 2 deletions

View File

@ -16,7 +16,8 @@ function init(config,log){
connect : connect,
emit : emit,
log : log,
retriesRemaining:config.maxRetries||0
retriesRemaining:config.maxRetries||0,
explicitlyDisconnected: false
};
new Pubsub(client);
@ -143,7 +144,9 @@ function connect(){
);
if(
client.config.stopRetrying || client.retriesRemaining<1
client.config.stopRetrying ||
client.retriesRemaining<1 ||
client.explicitlyDisconnected
){
client.trigger('disconnect');