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

View file

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