Comparing version 1.0.5 to 1.1.0
@@ -26,2 +26,9 @@ var ipc=require('../../../node-ipc'); | ||
); | ||
ipc.server.on( | ||
'socket.disconnected', | ||
function(data,socket){ | ||
console.log(arguments) | ||
} | ||
); | ||
} | ||
@@ -28,0 +35,0 @@ ); |
@@ -12,2 +12,3 @@ var ipc=require('../../../node-ipc'); | ||
ipc.config.retry= 1500; | ||
ipc.config.maxRetries= 10; | ||
@@ -14,0 +15,0 @@ ipc.connectToNet( |
@@ -12,2 +12,3 @@ var ipc=require('../../../node-ipc'); | ||
ipc.config.retry= 1500; | ||
ipc.config.maxRetries=10; | ||
@@ -14,0 +15,0 @@ ipc.connectToNet( |
@@ -20,3 +20,3 @@ var ipc=require('../../../node-ipc'); | ||
* | ||
* *************************************// | ||
***************************************/ | ||
@@ -44,3 +44,2 @@ ipc.config.id = 'world'; | ||
); | ||
} | ||
@@ -47,0 +46,0 @@ ); |
@@ -16,3 +16,3 @@ var ipc=require('../../../node-ipc'); | ||
* | ||
* *************************************/ | ||
***************************************/ | ||
@@ -19,0 +19,0 @@ ipc.config.id = 'world'; |
@@ -12,3 +12,3 @@ var net = require('net'), | ||
log : log, | ||
retryCount:0 | ||
retriesRemaining:0 | ||
} | ||
@@ -74,2 +74,4 @@ new pubsub(client); | ||
client.trigger('connect'); | ||
client.retriesRemaining=client.config.maxRetries||0; | ||
client.log('retrying reset') | ||
} | ||
@@ -83,8 +85,7 @@ ); | ||
if(client.config.stopRetrying || client.config.stopRetrying===0){ | ||
if(client.retryCount++>client.config.stopRetrying){ | ||
client.log(client.config.id.variable,'exceeded connection rety amount of'.warn,client.config.stopRetrying); | ||
client.socket.destroy(); | ||
return; | ||
} | ||
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; | ||
} | ||
@@ -98,2 +99,3 @@ | ||
return function(){ | ||
client.retriesRemaining--; | ||
client.isRetrying=false; | ||
@@ -104,3 +106,3 @@ client.connect(); | ||
if(!client.isRetrying) | ||
client.retryCount=0; | ||
client.retriesRemaining=ipc.config.maxRetries; | ||
}, | ||
@@ -107,0 +109,0 @@ 100 |
@@ -54,3 +54,3 @@ var net = require('net'), | ||
if(this.udp4 || this.udp6){ | ||
for(var i=0, count=this.sockets.length; i<count; i++){ | ||
for(var i=1, count=this.sockets.length; i<count; i++){ | ||
this.server.write(e,this.sockets[i]); | ||
@@ -190,2 +190,5 @@ } | ||
if(e.data.id) | ||
sock.id=e.data.id; | ||
server.trigger( | ||
@@ -305,2 +308,3 @@ e.type, | ||
var socket=server.sockets[i]; | ||
var destroyedSocketId=null; | ||
@@ -311,6 +315,8 @@ if(socket){ | ||
} | ||
server.log(socket.id, 'socket disconnected'.notice); | ||
var deadSocket=socket.id; | ||
if(socket.id) | ||
destroyedSocketId=socket.id; | ||
server.log('socket disconnected'.notice,' '+destroyedSocketId.variable); | ||
if(socket) | ||
@@ -320,14 +326,9 @@ socket.destroy(); | ||
server.sockets.splice(i,1); | ||
server.trigger( | ||
'socket.disconnected', | ||
{ | ||
id:deadSocket | ||
} | ||
); | ||
server.trigger('socket.disconnected', socket, destroyedSocketId); | ||
return; | ||
} | ||
} | ||
); | ||
); | ||
@@ -334,0 +335,0 @@ return server; |
@@ -67,3 +67,5 @@ var os = require('os'), | ||
return; | ||
ipc.of[id].stopRetrying=true; | ||
ipc.of[id].off('*'); | ||
@@ -70,0 +72,0 @@ if(ipc.of[id].socket){ |
{ | ||
"name": "node-ipc", | ||
"version": "1.0.5", | ||
"version": "1.1.0", | ||
"description": "A nodejs module for local and remote Inter Process Communication (IPC), Neural Networking, and able to facilitate machine learning.", | ||
@@ -5,0 +5,0 @@ "main": "node-ipc.js", |
@@ -12,2 +12,3 @@ #node-ipc | ||
This work is licenced via the [DBAD Public Licence](http://www.dbad-license.org/). | ||
@@ -67,2 +68,3 @@ ---- | ||
retry : 500, | ||
maxRetries : 0, | ||
stopRetrying : false | ||
@@ -83,2 +85,3 @@ } | ||
| retry | this is the time in milliseconds a client will wait before trying to reconnect to a server if the connection is lost. This does not effect UDP sockets since they do not have a client server relationship like Unix Sockets and TCP Sockets. | | ||
| maxRetries | the maximum number of retries after each disconnect before giving up and completely killing a specific connection | | ||
| stopRetrying| Defaults to false mwaning clients will continue to retryt to connect to servers indefinately at the retry interval. If set to any number the client will stop retrying when that number is exceeded after each disconnect. If set to 0, the client will ***NOT*** try to reconnect. | | ||
@@ -85,0 +88,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
64712
22
1306
473