cleaning up format
This commit is contained in:
parent
f176a01d1b
commit
6278fd472b
20 changed files with 971 additions and 951 deletions
|
@ -1,6 +1,10 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const Message = require('js-message');
|
const parser={
|
||||||
|
parse : parseDataEvents,
|
||||||
|
format : formatData,
|
||||||
|
delimiter : '\f'
|
||||||
|
};
|
||||||
|
|
||||||
function formatData(message){
|
function formatData(message){
|
||||||
if(!message.data){
|
if(!message.data){
|
||||||
|
@ -20,10 +24,4 @@ function parseDataEvents(data){
|
||||||
return events;
|
return events;
|
||||||
}
|
}
|
||||||
|
|
||||||
const parser={
|
|
||||||
parse : parseDataEvents,
|
|
||||||
format : formatData,
|
|
||||||
delimiter : '\f'
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports=parser;
|
module.exports=parser;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
const net = require('net'),
|
const net = require('net'),
|
||||||
tls = require('tls'),
|
tls = require('tls'),
|
||||||
fs = require('fs'),
|
fs = require('fs'),
|
||||||
|
@ -72,16 +74,16 @@ function init(path,config,log,port){
|
||||||
sockets : [],
|
sockets : [],
|
||||||
emit : emit,
|
emit : emit,
|
||||||
broadcast : broadcast,
|
broadcast : broadcast,
|
||||||
onStart : function(socket){
|
onStart : function onStart(socket){
|
||||||
this.trigger(
|
this.trigger(
|
||||||
'start',
|
'start',
|
||||||
socket
|
socket
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
stop:function(){
|
stop:function stop(){
|
||||||
server.server.close();
|
server.server.close();
|
||||||
},
|
},
|
||||||
start : function(){
|
start : function start(){
|
||||||
if(!this.path){
|
if(!this.path){
|
||||||
server.log('Socket Server Path not specified, refusing to start'.warn);
|
server.log('Socket Server Path not specified, refusing to start'.warn);
|
||||||
return;
|
return;
|
||||||
|
@ -89,9 +91,7 @@ function init(path,config,log,port){
|
||||||
|
|
||||||
fs.unlink(
|
fs.unlink(
|
||||||
this.path,
|
this.path,
|
||||||
(
|
function () {
|
||||||
function(server){
|
|
||||||
return function () {
|
|
||||||
server.log('starting server on '.debug,server.path.variable,((server.port)?':'+server.port:'').variable);
|
server.log('starting server on '.debug,server.path.variable,((server.port)?':'+server.port:'').variable);
|
||||||
|
|
||||||
if(!server.udp4 && !server.udp6){
|
if(!server.udp4 && !server.udp6){
|
||||||
|
@ -324,9 +324,7 @@ function init(path,config,log,port){
|
||||||
port : server.port
|
port : server.port
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
)(this)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
12
node-ipc.js
12
node-ipc.js
|
@ -106,7 +106,7 @@ function serve(path,callback){
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!callback){
|
if(!callback){
|
||||||
callback=function(){};
|
callback=emptyCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
ipc.server=new Server(
|
ipc.server=new Server(
|
||||||
|
@ -121,6 +121,10 @@ function serve(path,callback){
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function emptyCallback(){
|
||||||
|
//Do Nothing
|
||||||
|
}
|
||||||
|
|
||||||
function serveNet(host,port,UDPType,callback){
|
function serveNet(host,port,UDPType,callback){
|
||||||
if(typeof host=='number'){
|
if(typeof host=='number'){
|
||||||
callback=UDPType;
|
callback=UDPType;
|
||||||
|
@ -174,7 +178,7 @@ function serveNet(host,port,UDPType,callback){
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!callback){
|
if(!callback){
|
||||||
callback=function(){};
|
callback=emptyCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
ipc.server=new Server(
|
ipc.server=new Server(
|
||||||
|
@ -201,7 +205,7 @@ function connect(id,path,callback){
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!callback){
|
if(!callback){
|
||||||
callback=function(){};
|
callback=emptyCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!id){
|
if(!id){
|
||||||
|
@ -288,7 +292,7 @@ function connectNet(id,host,port,callback){
|
||||||
callback=false;
|
callback=false;
|
||||||
}
|
}
|
||||||
if(!callback){
|
if(!callback){
|
||||||
callback=function(){};
|
callback=emptyCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ipc.of[id]){
|
if(ipc.of[id]){
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -20,9 +20,9 @@
|
||||||
</h1>
|
</h1>
|
||||||
<div class='clearfix'>
|
<div class='clearfix'>
|
||||||
<div class='fl pad1y space-right2'>
|
<div class='fl pad1y space-right2'>
|
||||||
<span class="strong">67.65% </span>
|
<span class="strong">67.49% </span>
|
||||||
<span class="quiet">Statements</span>
|
<span class="quiet">Statements</span>
|
||||||
<span class='fraction'>274/405</span>
|
<span class='fraction'>272/403</span>
|
||||||
</div>
|
</div>
|
||||||
<div class='fl pad1y space-right2'>
|
<div class='fl pad1y space-right2'>
|
||||||
<span class="strong">56.37% </span>
|
<span class="strong">56.37% </span>
|
||||||
|
@ -30,14 +30,14 @@
|
||||||
<span class='fraction'>115/204</span>
|
<span class='fraction'>115/204</span>
|
||||||
</div>
|
</div>
|
||||||
<div class='fl pad1y space-right2'>
|
<div class='fl pad1y space-right2'>
|
||||||
<span class="strong">81.4% </span>
|
<span class="strong">80.95% </span>
|
||||||
<span class="quiet">Functions</span>
|
<span class="quiet">Functions</span>
|
||||||
<span class='fraction'>35/43</span>
|
<span class='fraction'>34/42</span>
|
||||||
</div>
|
</div>
|
||||||
<div class='fl pad1y space-right2'>
|
<div class='fl pad1y space-right2'>
|
||||||
<span class="strong">67.65% </span>
|
<span class="strong">67.49% </span>
|
||||||
<span class="quiet">Lines</span>
|
<span class="quiet">Lines</span>
|
||||||
<span class='fraction'>274/405</span>
|
<span class='fraction'>272/403</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -73,15 +73,15 @@
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="file medium" data-value="node-ipc/lib/"><a href="node-ipc/lib/index.html">node-ipc/lib/</a></td>
|
<td class="file medium" data-value="node-ipc/lib/"><a href="node-ipc/lib/index.html">node-ipc/lib/</a></td>
|
||||||
<td data-value="68.15" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 68%;"></div><div class="cover-empty" style="width:32%;"></div></div></td>
|
<td data-value="67.91" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 67%;"></div><div class="cover-empty" style="width:33%;"></div></div></td>
|
||||||
<td data-value="68.15" class="pct medium">68.15%</td>
|
<td data-value="67.91" class="pct medium">67.91%</td>
|
||||||
<td data-value="270" class="abs medium">184/270</td>
|
<td data-value="268" class="abs medium">182/268</td>
|
||||||
<td data-value="54.55" class="pct medium">54.55%</td>
|
<td data-value="54.55" class="pct medium">54.55%</td>
|
||||||
<td data-value="132" class="abs medium">72/132</td>
|
<td data-value="132" class="abs medium">72/132</td>
|
||||||
<td data-value="87.88" class="pct high">87.88%</td>
|
<td data-value="87.5" class="pct high">87.5%</td>
|
||||||
<td data-value="33" class="abs high">29/33</td>
|
<td data-value="32" class="abs high">28/32</td>
|
||||||
<td data-value="68.15" class="pct medium">68.15%</td>
|
<td data-value="67.91" class="pct medium">67.91%</td>
|
||||||
<td data-value="270" class="abs medium">184/270</td>
|
<td data-value="268" class="abs medium">182/268</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -90,7 +90,7 @@
|
||||||
</div><!-- /wrapper -->
|
</div><!-- /wrapper -->
|
||||||
<div class='footer quiet pad2 space-top1 center small'>
|
<div class='footer quiet pad2 space-top1 center small'>
|
||||||
Code coverage
|
Code coverage
|
||||||
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jan 10 2016 03:37:27 GMT-0800 (PST)
|
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jan 10 2016 04:44:52 GMT-0800 (PST)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="prettify.js"></script>
|
<script src="prettify.js"></script>
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
</div><!-- /wrapper -->
|
</div><!-- /wrapper -->
|
||||||
<div class='footer quiet pad2 space-top1 center small'>
|
<div class='footer quiet pad2 space-top1 center small'>
|
||||||
Code coverage
|
Code coverage
|
||||||
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jan 10 2016 03:37:27 GMT-0800 (PST)
|
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jan 10 2016 04:44:52 GMT-0800 (PST)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="../prettify.js"></script>
|
<script src="../prettify.js"></script>
|
||||||
|
|
|
@ -20,9 +20,9 @@
|
||||||
</h1>
|
</h1>
|
||||||
<div class='clearfix'>
|
<div class='clearfix'>
|
||||||
<div class='fl pad1y space-right2'>
|
<div class='fl pad1y space-right2'>
|
||||||
<span class="strong">73.08% </span>
|
<span class="strong">72.82% </span>
|
||||||
<span class="quiet">Statements</span>
|
<span class="quiet">Statements</span>
|
||||||
<span class='fraction'>76/104</span>
|
<span class='fraction'>75/103</span>
|
||||||
</div>
|
</div>
|
||||||
<div class='fl pad1y space-right2'>
|
<div class='fl pad1y space-right2'>
|
||||||
<span class="strong">52.38% </span>
|
<span class="strong">52.38% </span>
|
||||||
|
@ -32,12 +32,12 @@
|
||||||
<div class='fl pad1y space-right2'>
|
<div class='fl pad1y space-right2'>
|
||||||
<span class="strong">100% </span>
|
<span class="strong">100% </span>
|
||||||
<span class="quiet">Functions</span>
|
<span class="quiet">Functions</span>
|
||||||
<span class='fraction'>11/11</span>
|
<span class='fraction'>10/10</span>
|
||||||
</div>
|
</div>
|
||||||
<div class='fl pad1y space-right2'>
|
<div class='fl pad1y space-right2'>
|
||||||
<span class="strong">73.08% </span>
|
<span class="strong">72.82% </span>
|
||||||
<span class="quiet">Lines</span>
|
<span class="quiet">Lines</span>
|
||||||
<span class='fraction'>76/104</span>
|
<span class='fraction'>75/103</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -278,7 +278,10 @@
|
||||||
233
|
233
|
||||||
234
|
234
|
||||||
235
|
235
|
||||||
236</td><td class="line-coverage quiet"><span class="cline-any cline-yes">1×</span>
|
236
|
||||||
|
237</td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||||
|
<span class="cline-any cline-neutral"> </span>
|
||||||
|
<span class="cline-any cline-yes">1×</span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
|
@ -296,6 +299,7 @@
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-yes">7×</span>
|
<span class="cline-any cline-yes">7×</span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-yes">7×</span>
|
<span class="cline-any cline-yes">7×</span>
|
||||||
|
@ -439,8 +443,6 @@
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-yes">6×</span>
|
<span class="cline-any cline-yes">6×</span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
|
||||||
<span class="cline-any cline-yes">6×</span>
|
|
||||||
<span class="cline-any cline-yes">6×</span>
|
<span class="cline-any cline-yes">6×</span>
|
||||||
<span class="cline-any cline-yes">6×</span>
|
<span class="cline-any cline-yes">6×</span>
|
||||||
<span class="cline-any cline-yes">6×</span>
|
<span class="cline-any cline-yes">6×</span>
|
||||||
|
@ -456,7 +458,6 @@
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
|
||||||
<span class="cline-any cline-yes">6×</span>
|
<span class="cline-any cline-yes">6×</span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
|
@ -481,6 +482,7 @@
|
||||||
<span class="cline-any cline-yes">7×</span>
|
<span class="cline-any cline-yes">7×</span>
|
||||||
<span class="cline-any cline-yes">7×</span>
|
<span class="cline-any cline-yes">7×</span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-yes">7×</span>
|
<span class="cline-any cline-yes">7×</span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-yes">7×</span>
|
<span class="cline-any cline-yes">7×</span>
|
||||||
|
@ -513,16 +515,18 @@
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-yes">1×</span>
|
<span class="cline-any cline-yes">1×</span>
|
||||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">var net = require('net'),
|
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">'use strict';
|
||||||
|
|
||||||
|
const net = require('net'),
|
||||||
tls = require('tls'),
|
tls = require('tls'),
|
||||||
eventParser = require('../lib/eventParser.js'),
|
eventParser = require('../lib/eventParser.js'),
|
||||||
pubsub = require('event-pubsub'),
|
Pubsub = require('event-pubsub'),
|
||||||
Message = require('js-message'),
|
Message = require('js-message'),
|
||||||
fs = require('fs'),
|
fs = require('fs'),
|
||||||
Queue = require('js-queue');
|
Queue = require('js-queue');
|
||||||
|
|
||||||
function init(config,log){
|
function init(config,log){
|
||||||
var client={
|
let client={
|
||||||
config : config,
|
config : config,
|
||||||
queue : new Queue,
|
queue : new Queue,
|
||||||
socket : false,
|
socket : false,
|
||||||
|
@ -530,8 +534,9 @@ function init(config,log){
|
||||||
emit : emit,
|
emit : emit,
|
||||||
log : log,
|
log : log,
|
||||||
retriesRemaining:config.maxRetries||<span class="branch-1 cbranch-no" title="branch not covered" >0</span>
|
retriesRemaining:config.maxRetries||<span class="branch-1 cbranch-no" title="branch not covered" >0</span>
|
||||||
}
|
};
|
||||||
new pubsub(client);
|
|
||||||
|
new Pubsub(client);
|
||||||
|
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
@ -539,7 +544,7 @@ function init(config,log){
|
||||||
function emit(type,data){
|
function emit(type,data){
|
||||||
this.log('dispatching event to '.debug, this.id.variable, this.path.variable,' : ', type.data,',', data);
|
this.log('dispatching event to '.debug, this.id.variable, this.path.variable,' : ', type.data,',', data);
|
||||||
|
|
||||||
var message=new Message;
|
let message=new Message;
|
||||||
message.type=type;
|
message.type=type;
|
||||||
message.data=data;
|
message.data=data;
|
||||||
|
|
||||||
|
@ -557,7 +562,7 @@ function emit(type,data){
|
||||||
this.queue.add(
|
this.queue.add(
|
||||||
syncEmit.bind(this,message)
|
syncEmit.bind(this,message)
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
|
|
||||||
function syncEmit(message){
|
function syncEmit(message){
|
||||||
this.log('dispatching event to '.debug, this.id.variable, this.path.variable,' : ', message.data);
|
this.log('dispatching event to '.debug, this.id.variable, this.path.variable,' : ', message.data);
|
||||||
|
@ -566,7 +571,7 @@ function syncEmit(message){
|
||||||
|
|
||||||
function connect(){
|
function connect(){
|
||||||
//init client object for scope persistance especially inside of socket events.
|
//init client object for scope persistance especially inside of socket events.
|
||||||
var client=this;
|
let client=this;
|
||||||
|
|
||||||
client.log('requested connection to '.debug, client.id.variable, client.path.variable);
|
client.log('requested connection to '.debug, client.id.variable, client.path.variable);
|
||||||
<span class="missing-if-branch" title="if path not taken" >I</span>if(!this.path){
|
<span class="missing-if-branch" title="if path not taken" >I</span>if(!this.path){
|
||||||
|
@ -577,7 +582,7 @@ function connect(){
|
||||||
if(!client.port){
|
if(!client.port){
|
||||||
client.log('Connecting client on Unix Socket :'.debug, client.path.variable);
|
client.log('Connecting client on Unix Socket :'.debug, client.path.variable);
|
||||||
|
|
||||||
var path = client.path;
|
let path = client.path;
|
||||||
|
|
||||||
<span class="missing-if-branch" title="if path not taken" >I</span>if (process.platform ==='win32' && <span class="branch-1 cbranch-no" title="branch not covered" >!client.path.startsWith('\\\\.\\pipe\\'))</span>{
|
<span class="missing-if-branch" title="if path not taken" >I</span>if (process.platform ==='win32' && <span class="branch-1 cbranch-no" title="branch not covered" >!client.path.startsWith('\\\\.\\pipe\\'))</span>{
|
||||||
<span class="cstat-no" title="statement not covered" > path = path.replace(/^\//, '');</span>
|
<span class="cstat-no" title="statement not covered" > path = path.replace(/^\//, '');</span>
|
||||||
|
@ -611,7 +616,7 @@ function connect(){
|
||||||
<span class="cstat-no" title="statement not covered" > client.config.tls.trustedConnections=[client.config.tls.trustedConnections];</span>
|
<span class="cstat-no" title="statement not covered" > client.config.tls.trustedConnections=[client.config.tls.trustedConnections];</span>
|
||||||
}
|
}
|
||||||
<span class="cstat-no" title="statement not covered" > client.config.tls.ca=[];</span>
|
<span class="cstat-no" title="statement not covered" > client.config.tls.ca=[];</span>
|
||||||
<span class="cstat-no" title="statement not covered" > for(var i=0; i<client.config.tls.trustedConnections.length; i++){</span>
|
<span class="cstat-no" title="statement not covered" > for(let i=0; i<client.config.tls.trustedConnections.length; i++){</span>
|
||||||
<span class="cstat-no" title="statement not covered" > client.config.tls.ca.push(</span>
|
<span class="cstat-no" title="statement not covered" > client.config.tls.ca.push(</span>
|
||||||
fs.readFileSync(client.config.tls.trustedConnections[i])
|
fs.readFileSync(client.config.tls.trustedConnections[i])
|
||||||
);
|
);
|
||||||
|
@ -640,7 +645,7 @@ function connect(){
|
||||||
|
|
||||||
client.socket.on(
|
client.socket.on(
|
||||||
'connect',
|
'connect',
|
||||||
function(){
|
function connectionMade(){
|
||||||
client.trigger('connect');
|
client.trigger('connect');
|
||||||
client.retriesRemaining=client.config.maxRetries;
|
client.retriesRemaining=client.config.maxRetries;
|
||||||
client.log('retrying reset');
|
client.log('retrying reset');
|
||||||
|
@ -649,7 +654,7 @@ function connect(){
|
||||||
|
|
||||||
client.socket.on(
|
client.socket.on(
|
||||||
'close',
|
'close',
|
||||||
function(){
|
function connectionClosed(){
|
||||||
client.log('connection closed'.notice ,client.id.variable , client.path.variable, client.retriesRemaining+' tries remaining of '+client.config.maxRetries);
|
client.log('connection closed'.notice ,client.id.variable , client.path.variable, client.retriesRemaining+' tries remaining of '+client.config.maxRetries);
|
||||||
|
|
||||||
if(
|
if(
|
||||||
|
@ -660,7 +665,7 @@ function connect(){
|
||||||
client.log(
|
client.log(
|
||||||
client.config.id.variable,
|
client.config.id.variable,
|
||||||
'exceeded connection rety amount of'.warn,
|
'exceeded connection rety amount of'.warn,
|
||||||
" or stopRetrying flag set."
|
' or stopRetrying flag set.'
|
||||||
);
|
);
|
||||||
|
|
||||||
client.socket.destroy();
|
client.socket.destroy();
|
||||||
|
@ -673,22 +678,19 @@ function connect(){
|
||||||
client.isRetrying=true;
|
client.isRetrying=true;
|
||||||
|
|
||||||
setTimeout(
|
setTimeout(
|
||||||
(
|
function retryTimeout(){
|
||||||
function(client){
|
|
||||||
return function(){
|
|
||||||
client.retriesRemaining--;
|
client.retriesRemaining--;
|
||||||
client.isRetrying=false;
|
client.isRetrying=false;
|
||||||
client.connect();
|
client.connect();
|
||||||
setTimeout(
|
setTimeout(
|
||||||
function(){
|
function resetRetriesCheck(){
|
||||||
if(!client.isRetrying)
|
if(!client.isRetrying){
|
||||||
client.retriesRemaining=client.config.maxRetries;
|
client.retriesRemaining=client.config.maxRetries;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
100
|
100
|
||||||
)
|
);
|
||||||
}
|
}.bind(null,client),
|
||||||
}
|
|
||||||
)(client),
|
|
||||||
client.config.retry
|
client.config.retry
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -713,8 +715,9 @@ function connect(){
|
||||||
<span class="cstat-no" title="statement not covered" > return;</span>
|
<span class="cstat-no" title="statement not covered" > return;</span>
|
||||||
}
|
}
|
||||||
|
|
||||||
<span class="missing-if-branch" title="else path not taken" >E</span>if(!this.ipcBuffer)
|
<span class="missing-if-branch" title="else path not taken" >E</span>if(!this.ipcBuffer){
|
||||||
this.ipcBuffer='';
|
this.ipcBuffer='';
|
||||||
|
}
|
||||||
|
|
||||||
data=(this.ipcBuffer+=data);
|
data=(this.ipcBuffer+=data);
|
||||||
|
|
||||||
|
@ -725,10 +728,10 @@ function connect(){
|
||||||
|
|
||||||
this.ipcBuffer='';
|
this.ipcBuffer='';
|
||||||
|
|
||||||
var events = eventParser.parse(data);
|
const events = eventParser.parse(data);
|
||||||
var eCount = events.length;
|
const eCount = events.length;
|
||||||
for(var i=0; i<eCount; i++){
|
for(let i=0; i<eCount; i++){
|
||||||
var message=new Message;
|
let message=new Message;
|
||||||
message.load(events[i]);
|
message.load(events[i]);
|
||||||
|
|
||||||
client.log('detected event of type '.debug, message.type.data, message.data);
|
client.log('detected event of type '.debug, message.type.data, message.data);
|
||||||
|
@ -754,7 +757,7 @@ module.exports=init;
|
||||||
</div><!-- /wrapper -->
|
</div><!-- /wrapper -->
|
||||||
<div class='footer quiet pad2 space-top1 center small'>
|
<div class='footer quiet pad2 space-top1 center small'>
|
||||||
Code coverage
|
Code coverage
|
||||||
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jan 10 2016 03:37:27 GMT-0800 (PST)
|
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jan 10 2016 04:44:52 GMT-0800 (PST)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="../../prettify.js"></script>
|
<script src="../../prettify.js"></script>
|
||||||
|
|
|
@ -20,9 +20,9 @@
|
||||||
</h1>
|
</h1>
|
||||||
<div class='clearfix'>
|
<div class='clearfix'>
|
||||||
<div class='fl pad1y space-right2'>
|
<div class='fl pad1y space-right2'>
|
||||||
<span class="strong">85.71% </span>
|
<span class="strong">84.62% </span>
|
||||||
<span class="quiet">Statements</span>
|
<span class="quiet">Statements</span>
|
||||||
<span class='fraction'>12/14</span>
|
<span class='fraction'>11/13</span>
|
||||||
</div>
|
</div>
|
||||||
<div class='fl pad1y space-right2'>
|
<div class='fl pad1y space-right2'>
|
||||||
<span class="strong">50% </span>
|
<span class="strong">50% </span>
|
||||||
|
@ -35,9 +35,9 @@
|
||||||
<span class='fraction'>2/2</span>
|
<span class='fraction'>2/2</span>
|
||||||
</div>
|
</div>
|
||||||
<div class='fl pad1y space-right2'>
|
<div class='fl pad1y space-right2'>
|
||||||
<span class="strong">85.71% </span>
|
<span class="strong">84.62% </span>
|
||||||
<span class="quiet">Lines</span>
|
<span class="quiet">Lines</span>
|
||||||
<span class='fraction'>12/14</span>
|
<span class='fraction'>11/13</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -70,7 +70,13 @@
|
||||||
25
|
25
|
||||||
26
|
26
|
||||||
27
|
27
|
||||||
28</td><td class="line-coverage quiet"><span class="cline-any cline-yes">1×</span>
|
28</td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||||
|
<span class="cline-any cline-neutral"> </span>
|
||||||
|
<span class="cline-any cline-yes">1×</span>
|
||||||
|
<span class="cline-any cline-neutral"> </span>
|
||||||
|
<span class="cline-any cline-neutral"> </span>
|
||||||
|
<span class="cline-any cline-neutral"> </span>
|
||||||
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-yes">1×</span>
|
<span class="cline-any cline-yes">1×</span>
|
||||||
<span class="cline-any cline-yes">9×</span>
|
<span class="cline-any cline-yes">9×</span>
|
||||||
|
@ -91,13 +97,13 @@
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-yes">1×</span>
|
<span class="cline-any cline-yes">1×</span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">'use strict';
|
||||||
<span class="cline-any cline-neutral"> </span>
|
|
||||||
<span class="cline-any cline-neutral"> </span>
|
const parser={
|
||||||
<span class="cline-any cline-neutral"> </span>
|
parse : parseDataEvents,
|
||||||
<span class="cline-any cline-neutral"> </span>
|
format : formatData,
|
||||||
<span class="cline-any cline-yes">1×</span>
|
delimiter : '\f'
|
||||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">var Message = require('js-message');
|
};
|
||||||
|
|
||||||
function formatData(message){
|
function formatData(message){
|
||||||
<span class="missing-if-branch" title="if path not taken" >I</span>if(!message.data){
|
<span class="missing-if-branch" title="if path not taken" >I</span>if(!message.data){
|
||||||
|
@ -109,18 +115,12 @@ function formatData(message){
|
||||||
|
|
||||||
message=message.JSON+parser.delimiter;
|
message=message.JSON+parser.delimiter;
|
||||||
return message;
|
return message;
|
||||||
};
|
|
||||||
|
|
||||||
function parseDataEvents(data){
|
|
||||||
var events=data.split(parser.delimiter);
|
|
||||||
events.pop();
|
|
||||||
return events;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var parser={
|
function parseDataEvents(data){
|
||||||
parse : parseDataEvents,
|
let events=data.split(parser.delimiter);
|
||||||
format : formatData,
|
events.pop();
|
||||||
delimiter : '\f'
|
return events;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports=parser;
|
module.exports=parser;
|
||||||
|
@ -130,7 +130,7 @@ module.exports=parser;
|
||||||
</div><!-- /wrapper -->
|
</div><!-- /wrapper -->
|
||||||
<div class='footer quiet pad2 space-top1 center small'>
|
<div class='footer quiet pad2 space-top1 center small'>
|
||||||
Code coverage
|
Code coverage
|
||||||
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jan 10 2016 03:37:27 GMT-0800 (PST)
|
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jan 10 2016 04:44:52 GMT-0800 (PST)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="../../prettify.js"></script>
|
<script src="../../prettify.js"></script>
|
||||||
|
|
|
@ -20,9 +20,9 @@
|
||||||
</h1>
|
</h1>
|
||||||
<div class='clearfix'>
|
<div class='clearfix'>
|
||||||
<div class='fl pad1y space-right2'>
|
<div class='fl pad1y space-right2'>
|
||||||
<span class="strong">68.15% </span>
|
<span class="strong">67.91% </span>
|
||||||
<span class="quiet">Statements</span>
|
<span class="quiet">Statements</span>
|
||||||
<span class='fraction'>184/270</span>
|
<span class='fraction'>182/268</span>
|
||||||
</div>
|
</div>
|
||||||
<div class='fl pad1y space-right2'>
|
<div class='fl pad1y space-right2'>
|
||||||
<span class="strong">54.55% </span>
|
<span class="strong">54.55% </span>
|
||||||
|
@ -30,14 +30,14 @@
|
||||||
<span class='fraction'>72/132</span>
|
<span class='fraction'>72/132</span>
|
||||||
</div>
|
</div>
|
||||||
<div class='fl pad1y space-right2'>
|
<div class='fl pad1y space-right2'>
|
||||||
<span class="strong">87.88% </span>
|
<span class="strong">87.5% </span>
|
||||||
<span class="quiet">Functions</span>
|
<span class="quiet">Functions</span>
|
||||||
<span class='fraction'>29/33</span>
|
<span class='fraction'>28/32</span>
|
||||||
</div>
|
</div>
|
||||||
<div class='fl pad1y space-right2'>
|
<div class='fl pad1y space-right2'>
|
||||||
<span class="strong">68.15% </span>
|
<span class="strong">67.91% </span>
|
||||||
<span class="quiet">Lines</span>
|
<span class="quiet">Lines</span>
|
||||||
<span class='fraction'>184/270</span>
|
<span class='fraction'>182/268</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -60,28 +60,28 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody><tr>
|
<tbody><tr>
|
||||||
<td class="file medium" data-value="client.js"><a href="client.js.html">client.js</a></td>
|
<td class="file medium" data-value="client.js"><a href="client.js.html">client.js</a></td>
|
||||||
<td data-value="73.08" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 73%;"></div><div class="cover-empty" style="width:27%;"></div></div></td>
|
<td data-value="72.82" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 72%;"></div><div class="cover-empty" style="width:28%;"></div></div></td>
|
||||||
<td data-value="73.08" class="pct medium">73.08%</td>
|
<td data-value="72.82" class="pct medium">72.82%</td>
|
||||||
<td data-value="104" class="abs medium">76/104</td>
|
<td data-value="103" class="abs medium">75/103</td>
|
||||||
<td data-value="52.38" class="pct medium">52.38%</td>
|
<td data-value="52.38" class="pct medium">52.38%</td>
|
||||||
<td data-value="42" class="abs medium">22/42</td>
|
<td data-value="42" class="abs medium">22/42</td>
|
||||||
<td data-value="100" class="pct high">100%</td>
|
<td data-value="100" class="pct high">100%</td>
|
||||||
<td data-value="11" class="abs high">11/11</td>
|
<td data-value="10" class="abs high">10/10</td>
|
||||||
<td data-value="73.08" class="pct medium">73.08%</td>
|
<td data-value="72.82" class="pct medium">72.82%</td>
|
||||||
<td data-value="104" class="abs medium">76/104</td>
|
<td data-value="103" class="abs medium">75/103</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="file high" data-value="eventParser.js"><a href="eventParser.js.html">eventParser.js</a></td>
|
<td class="file high" data-value="eventParser.js"><a href="eventParser.js.html">eventParser.js</a></td>
|
||||||
<td data-value="85.71" class="pic high"><div class="chart"><div class="cover-fill" style="width: 85%;"></div><div class="cover-empty" style="width:15%;"></div></div></td>
|
<td data-value="84.62" class="pic high"><div class="chart"><div class="cover-fill" style="width: 84%;"></div><div class="cover-empty" style="width:16%;"></div></div></td>
|
||||||
<td data-value="85.71" class="pct high">85.71%</td>
|
<td data-value="84.62" class="pct high">84.62%</td>
|
||||||
<td data-value="14" class="abs high">12/14</td>
|
<td data-value="13" class="abs high">11/13</td>
|
||||||
<td data-value="50" class="pct medium">50%</td>
|
<td data-value="50" class="pct medium">50%</td>
|
||||||
<td data-value="4" class="abs medium">2/4</td>
|
<td data-value="4" class="abs medium">2/4</td>
|
||||||
<td data-value="100" class="pct high">100%</td>
|
<td data-value="100" class="pct high">100%</td>
|
||||||
<td data-value="2" class="abs high">2/2</td>
|
<td data-value="2" class="abs high">2/2</td>
|
||||||
<td data-value="85.71" class="pct high">85.71%</td>
|
<td data-value="84.62" class="pct high">84.62%</td>
|
||||||
<td data-value="14" class="abs high">12/14</td>
|
<td data-value="13" class="abs high">11/13</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -103,7 +103,7 @@
|
||||||
</div><!-- /wrapper -->
|
</div><!-- /wrapper -->
|
||||||
<div class='footer quiet pad2 space-top1 center small'>
|
<div class='footer quiet pad2 space-top1 center small'>
|
||||||
Code coverage
|
Code coverage
|
||||||
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jan 10 2016 03:37:27 GMT-0800 (PST)
|
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jan 10 2016 04:44:52 GMT-0800 (PST)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="../../prettify.js"></script>
|
<script src="../../prettify.js"></script>
|
||||||
|
|
|
@ -410,7 +410,15 @@
|
||||||
365
|
365
|
||||||
366
|
366
|
||||||
367
|
367
|
||||||
368</td><td class="line-coverage quiet"><span class="cline-any cline-yes">1×</span>
|
368
|
||||||
|
369
|
||||||
|
370
|
||||||
|
371
|
||||||
|
372
|
||||||
|
373
|
||||||
|
374</td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||||
|
<span class="cline-any cline-neutral"> </span>
|
||||||
|
<span class="cline-any cline-yes">1×</span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
|
@ -597,6 +605,7 @@
|
||||||
<span class="cline-any cline-yes">4×</span>
|
<span class="cline-any cline-yes">4×</span>
|
||||||
<span class="cline-any cline-yes">2×</span>
|
<span class="cline-any cline-yes">2×</span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-yes">4×</span>
|
<span class="cline-any cline-yes">4×</span>
|
||||||
<span class="cline-any cline-yes">4×</span>
|
<span class="cline-any cline-yes">4×</span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
|
@ -634,6 +643,7 @@
|
||||||
<span class="cline-any cline-yes">2×</span>
|
<span class="cline-any cline-yes">2×</span>
|
||||||
<span class="cline-any cline-yes">2×</span>
|
<span class="cline-any cline-yes">2×</span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-yes">2×</span>
|
<span class="cline-any cline-yes">2×</span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-yes">2×</span>
|
<span class="cline-any cline-yes">2×</span>
|
||||||
|
@ -668,6 +678,8 @@
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-yes">2×</span>
|
<span class="cline-any cline-yes">2×</span>
|
||||||
<span class="cline-any cline-no"> </span>
|
<span class="cline-any cline-no"> </span>
|
||||||
|
<span class="cline-any cline-neutral"> </span>
|
||||||
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-yes">2×</span>
|
<span class="cline-any cline-yes">2×</span>
|
||||||
<span class="cline-any cline-yes">2×</span>
|
<span class="cline-any cline-yes">2×</span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
|
@ -777,18 +789,20 @@
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-yes">1×</span>
|
<span class="cline-any cline-yes">1×</span>
|
||||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">var net = require('net'),
|
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">'use strict';
|
||||||
|
|
||||||
|
const net = require('net'),
|
||||||
tls = require('tls'),
|
tls = require('tls'),
|
||||||
fs = require('fs'),
|
fs = require('fs'),
|
||||||
dgram = require('dgram'),
|
dgram = require('dgram'),
|
||||||
eventParser = require('../lib/eventParser.js'),
|
eventParser = require('../lib/eventParser.js'),
|
||||||
pubsub = require('event-pubsub'),
|
Pubsub = require('event-pubsub'),
|
||||||
Message = require('js-message');
|
Message = require('js-message');
|
||||||
|
|
||||||
function emit(socket, type, data){
|
function emit(socket, type, data){
|
||||||
this.log('dispatching event to socket'.debug, ' : ', type.data, data);
|
this.log('dispatching event to socket'.debug, ' : ', type.data, data);
|
||||||
|
|
||||||
var message=new Message;
|
let message=new Message;
|
||||||
message.type=type;
|
message.type=type;
|
||||||
message.data=data;
|
message.data=data;
|
||||||
|
|
||||||
|
@ -811,14 +825,14 @@ function emit(socket, type, data){
|
||||||
socket
|
socket
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
};
|
}
|
||||||
|
|
||||||
<span class="cstat-no" title="statement not covered" > socket.write(message);</span>
|
<span class="cstat-no" title="statement not covered" > socket.write(message);</span>
|
||||||
};
|
}
|
||||||
|
|
||||||
<span class="fstat-no" title="function not covered" >function broadcast(type,data){</span>
|
<span class="fstat-no" title="function not covered" >function broadcast(type,data){</span>
|
||||||
<span class="cstat-no" title="statement not covered" > this.log('broadcasting event to all known sockets listening to '.debug, this.path.variable,' : ', ((this.port)?this.port:''), type, data);</span>
|
<span class="cstat-no" title="statement not covered" > this.log('broadcasting event to all known sockets listening to '.debug, this.path.variable,' : ', ((this.port)?this.port:''), type, data);</span>
|
||||||
<span class="cstat-no" title="statement not covered" > var message=new Message;</span>
|
<span class="cstat-no" title="statement not covered" > let message=new Message;</span>
|
||||||
<span class="cstat-no" title="statement not covered" > message.type=type;</span>
|
<span class="cstat-no" title="statement not covered" > message.type=type;</span>
|
||||||
<span class="cstat-no" title="statement not covered" > message.data=data;</span>
|
<span class="cstat-no" title="statement not covered" > message.data=data;</span>
|
||||||
|
|
||||||
|
@ -829,18 +843,18 @@ function emit(socket, type, data){
|
||||||
}
|
}
|
||||||
|
|
||||||
<span class="cstat-no" title="statement not covered" > if(this.udp4 || this.udp6){</span>
|
<span class="cstat-no" title="statement not covered" > if(this.udp4 || this.udp6){</span>
|
||||||
<span class="cstat-no" title="statement not covered" > for(var i=1, count=this.sockets.length; i<count; i++){</span>
|
<span class="cstat-no" title="statement not covered" > for(let i=1, count=this.sockets.length; i<count; i++){</span>
|
||||||
<span class="cstat-no" title="statement not covered" > this.server.write(message,this.sockets[i]);</span>
|
<span class="cstat-no" title="statement not covered" > this.server.write(message,this.sockets[i]);</span>
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
<span class="cstat-no" title="statement not covered" > for(var i=0, count=this.sockets.length; i<count; i++){</span>
|
<span class="cstat-no" title="statement not covered" > for(let i=0, count=this.sockets.length; i<count; i++){</span>
|
||||||
<span class="cstat-no" title="statement not covered" > this.sockets[i].write(message);</span>
|
<span class="cstat-no" title="statement not covered" > this.sockets[i].write(message);</span>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
function init(path,config,log,port){
|
function init(path,config,log,port){
|
||||||
var server={
|
let server={
|
||||||
config : config,
|
config : config,
|
||||||
path : path,
|
path : path,
|
||||||
port : port,
|
port : port,
|
||||||
|
@ -898,7 +912,7 @@ function init(path,config,log,port){
|
||||||
<span class="cstat-no" title="statement not covered" > server.config.tls.trustedConnections=[server.config.tls.trustedConnections];</span>
|
<span class="cstat-no" title="statement not covered" > server.config.tls.trustedConnections=[server.config.tls.trustedConnections];</span>
|
||||||
}
|
}
|
||||||
<span class="cstat-no" title="statement not covered" > server.config.tls.ca=[];</span>
|
<span class="cstat-no" title="statement not covered" > server.config.tls.ca=[];</span>
|
||||||
<span class="cstat-no" title="statement not covered" > for(var i=0; i<server.config.tls.trustedConnections.length; i++){</span>
|
<span class="cstat-no" title="statement not covered" > for(let i=0; i<server.config.tls.trustedConnections.length; i++){</span>
|
||||||
<span class="cstat-no" title="statement not covered" > server.config.tls.ca.push(</span>
|
<span class="cstat-no" title="statement not covered" > server.config.tls.ca.push(</span>
|
||||||
fs.readFileSync(server.config.tls.trustedConnections[i])
|
fs.readFileSync(server.config.tls.trustedConnections[i])
|
||||||
);
|
);
|
||||||
|
@ -911,7 +925,7 @@ function init(path,config,log,port){
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
function UDPWrite(message,socket){
|
function UDPWrite(message,socket){
|
||||||
var data=new Buffer(message, server.config.encoding);
|
let data=new Buffer(message, server.config.encoding);
|
||||||
server.server.send(
|
server.server.send(
|
||||||
data,
|
data,
|
||||||
0,
|
0,
|
||||||
|
@ -939,7 +953,7 @@ function init(path,config,log,port){
|
||||||
server.server.on(
|
server.server.on(
|
||||||
'listening',
|
'listening',
|
||||||
function () {
|
function () {
|
||||||
serverCreated(server.server)
|
serverCreated(server.server);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -952,7 +966,7 @@ function init(path,config,log,port){
|
||||||
<span class="cstat-no" title="statement not covered" > server.trigger(</span>
|
<span class="cstat-no" title="statement not covered" > server.trigger(</span>
|
||||||
'error',
|
'error',
|
||||||
err
|
err
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -961,8 +975,9 @@ function init(path,config,log,port){
|
||||||
function serverCreated(socket) {
|
function serverCreated(socket) {
|
||||||
server.sockets.push(socket);
|
server.sockets.push(socket);
|
||||||
|
|
||||||
if(socket.setEncoding)
|
if(socket.setEncoding){
|
||||||
socket.setEncoding(server.config.encoding);
|
socket.setEncoding(server.config.encoding);
|
||||||
|
}
|
||||||
|
|
||||||
server.log('## socket connection to server detected ##'.rainbow);
|
server.log('## socket connection to server detected ##'.rainbow);
|
||||||
socket.on(
|
socket.on(
|
||||||
|
@ -987,7 +1002,7 @@ function init(path,config,log,port){
|
||||||
socket.on(
|
socket.on(
|
||||||
'data',
|
'data',
|
||||||
function(data,UDPSocket){
|
function(data,UDPSocket){
|
||||||
var sock=((server.udp4 || server.udp6)? UDPSocket : <span class="branch-1 cbranch-no" title="branch not covered" >socket)</span>;
|
let sock=((server.udp4 || server.udp6)? UDPSocket : <span class="branch-1 cbranch-no" title="branch not covered" >socket)</span>;
|
||||||
<span class="missing-if-branch" title="if path not taken" >I</span>if(server.config.rawBuffer){
|
<span class="missing-if-branch" title="if path not taken" >I</span>if(server.config.rawBuffer){
|
||||||
<span class="cstat-no" title="statement not covered" > data=new Buffer(data,this.encoding);</span>
|
<span class="cstat-no" title="statement not covered" > data=new Buffer(data,this.encoding);</span>
|
||||||
<span class="cstat-no" title="statement not covered" > server.trigger(</span>
|
<span class="cstat-no" title="statement not covered" > server.trigger(</span>
|
||||||
|
@ -998,8 +1013,9 @@ function init(path,config,log,port){
|
||||||
<span class="cstat-no" title="statement not covered" > return;</span>
|
<span class="cstat-no" title="statement not covered" > return;</span>
|
||||||
}
|
}
|
||||||
|
|
||||||
<span class="missing-if-branch" title="else path not taken" >E</span>if(!this.ipcBuffer)
|
<span class="missing-if-branch" title="else path not taken" >E</span>if(!this.ipcBuffer){
|
||||||
this.ipcBuffer='';
|
this.ipcBuffer='';
|
||||||
|
}
|
||||||
|
|
||||||
data=(this.ipcBuffer+=data);
|
data=(this.ipcBuffer+=data);
|
||||||
|
|
||||||
|
@ -1013,7 +1029,7 @@ function init(path,config,log,port){
|
||||||
data=eventParser.parse(data);
|
data=eventParser.parse(data);
|
||||||
|
|
||||||
while(data.length>0){
|
while(data.length>0){
|
||||||
var message=new Message;
|
let message=new Message;
|
||||||
message.load(data.shift());
|
message.load(data.shift());
|
||||||
|
|
||||||
server.log('received event of : '.debug,message.type.data,message.data);
|
server.log('received event of : '.debug,message.type.data,message.data);
|
||||||
|
@ -1033,10 +1049,12 @@ function init(path,config,log,port){
|
||||||
socket.on(
|
socket.on(
|
||||||
'message',
|
'message',
|
||||||
function(msg,rinfo) {
|
function(msg,rinfo) {
|
||||||
<span class="missing-if-branch" title="if path not taken" >I</span>if (!rinfo)
|
<span class="missing-if-branch" title="if path not taken" >I</span>if (!rinfo){
|
||||||
<span class="cstat-no" title="statement not covered" > return;</span>
|
<span class="cstat-no" title="statement not covered" > return;</span>
|
||||||
|
}
|
||||||
|
|
||||||
server.log('Received UDP message from '.debug, rinfo.address.variable, rinfo.port);
|
server.log('Received UDP message from '.debug, rinfo.address.variable, rinfo.port);
|
||||||
var data;
|
let data;
|
||||||
|
|
||||||
<span class="missing-if-branch" title="if path not taken" >I</span>if(server.config.rawSocket){
|
<span class="missing-if-branch" title="if path not taken" >I</span>if(server.config.rawSocket){
|
||||||
<span class="cstat-no" title="statement not covered" > data=new Buffer(msg,this.encoding);</span>
|
<span class="cstat-no" title="statement not covered" > data=new Buffer(msg,this.encoding);</span>
|
||||||
|
@ -1058,7 +1076,7 @@ function init(path,config,log,port){
|
||||||
}
|
}
|
||||||
|
|
||||||
function started(socket){
|
function started(socket){
|
||||||
server.onStart(socket)
|
server.onStart(socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!port){
|
if(!port){
|
||||||
|
@ -1099,21 +1117,21 @@ function init(path,config,log,port){
|
||||||
port : server.port
|
port : server.port
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
)(this)
|
)(this)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
new pubsub(server);
|
new Pubsub(server);
|
||||||
|
|
||||||
server.on(
|
server.on(
|
||||||
'close',
|
'close',
|
||||||
function(){
|
function(){
|
||||||
for(var i=0, count=server.sockets.length; i<count; i++){
|
for(let i=0, count=server.sockets.length; i<count; i++){
|
||||||
var socket=server.sockets[i];
|
let socket=server.sockets[i];
|
||||||
var destroyedSocketId=false;
|
let destroyedSocketId=false;
|
||||||
|
|
||||||
<span class="missing-if-branch" title="else path not taken" >E</span>if(socket){
|
<span class="missing-if-branch" title="else path not taken" >E</span>if(socket){
|
||||||
<span class="missing-if-branch" title="if path not taken" >I</span>if(socket.readable){
|
<span class="missing-if-branch" title="if path not taken" >I</span>if(socket.readable){
|
||||||
|
@ -1150,7 +1168,7 @@ module.exports=init;
|
||||||
</div><!-- /wrapper -->
|
</div><!-- /wrapper -->
|
||||||
<div class='footer quiet pad2 space-top1 center small'>
|
<div class='footer quiet pad2 space-top1 center small'>
|
||||||
Code coverage
|
Code coverage
|
||||||
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jan 10 2016 03:37:27 GMT-0800 (PST)
|
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jan 10 2016 04:44:52 GMT-0800 (PST)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="../../prettify.js"></script>
|
<script src="../../prettify.js"></script>
|
||||||
|
|
|
@ -359,8 +359,10 @@
|
||||||
314
|
314
|
||||||
315
|
315
|
||||||
316
|
316
|
||||||
317</td><td class="line-coverage quiet"><span class="cline-any cline-yes">1×</span>
|
317
|
||||||
|
318</td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
|
<span class="cline-any cline-yes">1×</span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
|
@ -675,11 +677,12 @@
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-neutral"> </span>
|
<span class="cline-any cline-neutral"> </span>
|
||||||
<span class="cline-any cline-yes">1×</span>
|
<span class="cline-any cline-yes">1×</span>
|
||||||
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">var os = require('os'),
|
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">'use strict';
|
||||||
|
|
||||||
|
const os = require('os'),
|
||||||
dns = require('dns'),
|
dns = require('dns'),
|
||||||
util = require('util'),
|
util = require('util'),
|
||||||
colors = require('colors'),
|
colors = require('colors'),
|
||||||
pubsub = require('event-pubsub'),
|
|
||||||
eventParser = require('./lib/eventParser.js'),
|
eventParser = require('./lib/eventParser.js'),
|
||||||
Client = require('./lib/client.js'),
|
Client = require('./lib/client.js'),
|
||||||
Server = require('./lib/socketServer.js');
|
Server = require('./lib/socketServer.js');
|
||||||
|
@ -696,11 +699,11 @@ colors.setTheme(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
var IPType=os.networkInterfaces()[
|
const IPType=os.networkInterfaces()[
|
||||||
Object.keys(os.networkInterfaces())[0]
|
Object.keys(os.networkInterfaces())[0]
|
||||||
][0].family
|
][0].family;
|
||||||
|
|
||||||
var defaults={
|
let defaults={
|
||||||
appspace : 'app.',
|
appspace : 'app.',
|
||||||
socketRoot : '/tmp/',
|
socketRoot : '/tmp/',
|
||||||
networkHost : (IPType=='IPv6')? <span class="branch-0 cbranch-no" title="branch not covered" >'::1' </span>: '127.0.0.1',
|
networkHost : (IPType=='IPv6')? <span class="branch-0 cbranch-no" title="branch not covered" >'::1' </span>: '127.0.0.1',
|
||||||
|
@ -716,9 +719,9 @@ var defaults={
|
||||||
stopRetrying : false,
|
stopRetrying : false,
|
||||||
IPType : IPType,
|
IPType : IPType,
|
||||||
tls : false
|
tls : false
|
||||||
}
|
};
|
||||||
|
|
||||||
var ipc = {
|
let ipc = {
|
||||||
config : defaults,
|
config : defaults,
|
||||||
connectTo : connect,
|
connectTo : connect,
|
||||||
connectToNet: connectNet,
|
connectToNet: connectNet,
|
||||||
|
@ -728,16 +731,16 @@ var ipc = {
|
||||||
of : {},
|
of : {},
|
||||||
server : false,
|
server : false,
|
||||||
log : log
|
log : log
|
||||||
}
|
};
|
||||||
|
|
||||||
function log(){
|
function log(){
|
||||||
<span class="missing-if-branch" title="if path not taken" >I</span>if(ipc.config.silent){
|
<span class="missing-if-branch" title="if path not taken" >I</span>if(ipc.config.silent){
|
||||||
<span class="cstat-no" title="statement not covered" > return;</span>
|
<span class="cstat-no" title="statement not covered" > return;</span>
|
||||||
}
|
}
|
||||||
|
|
||||||
var args=Array.prototype.slice.call(arguments);
|
let args=Array.prototype.slice.call(arguments);
|
||||||
|
|
||||||
for(var i=0, count=args.length; i<count; i++){
|
for(let i=0, count=args.length; i<count; i++){
|
||||||
if(typeof args[i] != 'object'){
|
if(typeof args[i] != 'object'){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -765,7 +768,7 @@ function disconnect(id){
|
||||||
}
|
}
|
||||||
|
|
||||||
delete ipc.of[id];
|
delete ipc.of[id];
|
||||||
};
|
}
|
||||||
|
|
||||||
function serve(path,callback){
|
function serve(path,callback){
|
||||||
<span class="missing-if-branch" title="if path not taken" >I</span>if(typeof path=='function'){
|
<span class="missing-if-branch" title="if path not taken" >I</span>if(typeof path=='function'){
|
||||||
|
@ -997,7 +1000,7 @@ module.exports=ipc;
|
||||||
</div><!-- /wrapper -->
|
</div><!-- /wrapper -->
|
||||||
<div class='footer quiet pad2 space-top1 center small'>
|
<div class='footer quiet pad2 space-top1 center small'>
|
||||||
Code coverage
|
Code coverage
|
||||||
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jan 10 2016 03:37:27 GMT-0800 (PST)
|
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Sun Jan 10 2016 04:44:52 GMT-0800 (PST)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="../prettify.js"></script>
|
<script src="../prettify.js"></script>
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
||||||
var addSorting = (function () {
|
var addSorting = (function () {
|
||||||
'use strict';
|
"use strict";
|
||||||
var cols,
|
var cols,
|
||||||
currentSort = {
|
currentSort = {
|
||||||
index: 0,
|
index: 0,
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -7,7 +7,7 @@ describe('TCP Socket verification of client',
|
||||||
function TCPClientSpec(){
|
function TCPClientSpec(){
|
||||||
it(
|
it(
|
||||||
'Verify retry attempts by TCP client to connect to the server as per the value set in "maxRetries" parameter.',
|
'Verify retry attempts by TCP client to connect to the server as per the value set in "maxRetries" parameter.',
|
||||||
function(done){
|
function testIt(done){
|
||||||
ipc.config.id ='testClient';
|
ipc.config.id ='testClient';
|
||||||
ipc.config.retry = 600;
|
ipc.config.retry = 600;
|
||||||
ipc.config.maxRetries = 3;
|
ipc.config.maxRetries = 3;
|
||||||
|
@ -97,7 +97,7 @@ describe('TCP Socket verification of client',
|
||||||
function connected(){
|
function connected(){
|
||||||
ipc.of.tcpServer.on(
|
ipc.of.tcpServer.on(
|
||||||
'message',
|
'message',
|
||||||
function(data,socket){
|
function gotMessage(data){
|
||||||
expect(data.id).toBe('tcpServer');
|
expect(data.id).toBe('tcpServer');
|
||||||
expect(data.message).toBe('I am TCP server!');
|
expect(data.message).toBe('I am TCP server!');
|
||||||
testDone();
|
testDone();
|
||||||
|
|
|
@ -61,7 +61,7 @@ describe(
|
||||||
|
|
||||||
it(
|
it(
|
||||||
'Verify UDP server of type udp6 connects to UDP server named "udp6Server" and receives message.',
|
'Verify UDP server of type udp6 connects to UDP server named "udp6Server" and receives message.',
|
||||||
function(done){
|
function testIt(done){
|
||||||
ipc.config.networkPort=8099;
|
ipc.config.networkPort=8099;
|
||||||
ipc.config.id ='testClient';
|
ipc.config.id ='testClient';
|
||||||
ipc.config.retry = 600;
|
ipc.config.retry = 600;
|
||||||
|
@ -75,7 +75,8 @@ describe(
|
||||||
function serverStarted(){
|
function serverStarted(){
|
||||||
ipc.server.on(
|
ipc.server.on(
|
||||||
'message',
|
'message',
|
||||||
function(data,socket){
|
function gotMessage(data,socket){
|
||||||
|
expect(socket).toBeDefined();
|
||||||
expect(data.id).toBe('udp6Server');
|
expect(data.id).toBe('udp6Server');
|
||||||
expect(data.message).toBe('I am UDP6 server!');
|
expect(data.message).toBe('I am UDP6 server!');
|
||||||
testDone();
|
testDone();
|
||||||
|
|
|
@ -98,7 +98,7 @@ describe('Test Cases for Unix client: ',
|
||||||
function connected(){
|
function connected(){
|
||||||
ipc.of.unixServer.on(
|
ipc.of.unixServer.on(
|
||||||
'message',
|
'message',
|
||||||
function(data){
|
function gotMessage(data){
|
||||||
expect(data.id).toBe('unixServer');
|
expect(data.id).toBe('unixServer');
|
||||||
expect(data.message).toBe('I am unix server!');
|
expect(data.message).toBe('I am unix server!');
|
||||||
testDone();
|
testDone();
|
||||||
|
|
|
@ -23,7 +23,7 @@ describe(
|
||||||
function serverStarted(){
|
function serverStarted(){
|
||||||
ipc.server.on(
|
ipc.server.on(
|
||||||
'connect',
|
'connect',
|
||||||
function(data,socket){
|
function connected(){
|
||||||
clientCounter++;
|
clientCounter++;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -31,7 +31,7 @@ describe(
|
||||||
);
|
);
|
||||||
|
|
||||||
setTimeout(
|
setTimeout(
|
||||||
function(){
|
function clientCountDelay(){
|
||||||
expect(clientCounter).toBe(ipc.config.maxConnections);
|
expect(clientCounter).toBe(ipc.config.maxConnections);
|
||||||
ipc.server.stop();
|
ipc.server.stop();
|
||||||
done();
|
done();
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const ipc = require('../../../../node-ipc');
|
|
||||||
const cmd=require('node-cmd');
|
const cmd=require('node-cmd');
|
||||||
|
|
||||||
cmd.run(`node ${__dirname}/unixServer.js`);
|
cmd.run(`node ${__dirname}/unixServer.js`);
|
||||||
|
|
Loading…
Reference in a new issue