From 143e23ca4d260fe54c8a2ddf9f3e4ec3756dc0a3 Mon Sep 17 00:00:00 2001 From: Brandon Nozaki Miller Date: Sun, 10 Jan 2016 20:59:40 -0800 Subject: [PATCH] migrating to es6 --- {lib => dao}/client.js | 2 +- {lib => dao}/eventParser.js | 0 {lib => dao}/socketServer.js | 2 +- entities/Defaults.js | 93 ++ entities/LogColors.js | 15 + node-ipc.js | 328 +---- package.json | 3 +- services/IPC.js | 328 +++++ spec/coverage/coverage.json | 2 +- spec/coverage/lcov-report/index.html | 62 +- .../lcov-report/node-ipc/dao/client.js.html | 773 +++++++++++ .../node-ipc/dao/eventParser.js.html | 146 ++ .../lcov-report/node-ipc/dao/index.html | 119 ++ .../node-ipc/dao/socketServer.js.html | 1172 +++++++++++++++++ .../node-ipc/entities/Defaults.js.html | 344 +++++ .../node-ipc/entities/LogColors.js.html | 110 ++ .../lcov-report/node-ipc/entities/index.html | 106 ++ spec/coverage/lcov-report/node-ipc/index.html | 40 +- .../lcov-report/node-ipc/node-ipc.js.html | 938 +------------ .../lcov-report/node-ipc/services/IPC.js.html | 1049 +++++++++++++++ .../lcov-report/node-ipc/services/index.html | 93 ++ spec/coverage/lcov.info | 445 ++++--- 22 files changed, 4709 insertions(+), 1461 deletions(-) rename {lib => dao}/client.js (99%) rename {lib => dao}/eventParser.js (100%) rename {lib => dao}/socketServer.js (99%) create mode 100644 entities/Defaults.js create mode 100644 entities/LogColors.js create mode 100644 services/IPC.js create mode 100644 spec/coverage/lcov-report/node-ipc/dao/client.js.html create mode 100644 spec/coverage/lcov-report/node-ipc/dao/eventParser.js.html create mode 100644 spec/coverage/lcov-report/node-ipc/dao/index.html create mode 100644 spec/coverage/lcov-report/node-ipc/dao/socketServer.js.html create mode 100644 spec/coverage/lcov-report/node-ipc/entities/Defaults.js.html create mode 100644 spec/coverage/lcov-report/node-ipc/entities/LogColors.js.html create mode 100644 spec/coverage/lcov-report/node-ipc/entities/index.html create mode 100644 spec/coverage/lcov-report/node-ipc/services/IPC.js.html create mode 100644 spec/coverage/lcov-report/node-ipc/services/index.html diff --git a/lib/client.js b/dao/client.js similarity index 99% rename from lib/client.js rename to dao/client.js index 18d3f2e..ddb38c0 100644 --- a/lib/client.js +++ b/dao/client.js @@ -2,7 +2,7 @@ const net = require('net'), tls = require('tls'), - eventParser = require('../lib/eventParser.js'), + eventParser = require('./eventParser.js'), Pubsub = require('event-pubsub'), Message = require('js-message'), fs = require('fs'), diff --git a/lib/eventParser.js b/dao/eventParser.js similarity index 100% rename from lib/eventParser.js rename to dao/eventParser.js diff --git a/lib/socketServer.js b/dao/socketServer.js similarity index 99% rename from lib/socketServer.js rename to dao/socketServer.js index 115e2d5..b2efc12 100644 --- a/lib/socketServer.js +++ b/dao/socketServer.js @@ -4,7 +4,7 @@ const net = require('net'), tls = require('tls'), fs = require('fs'), dgram = require('dgram'), - eventParser = require('../lib/eventParser.js'), + eventParser = require('./eventParser.js'), Pubsub = require('event-pubsub'), Message = require('js-message'); diff --git a/entities/Defaults.js b/entities/Defaults.js new file mode 100644 index 0000000..42cc94d --- /dev/null +++ b/entities/Defaults.js @@ -0,0 +1,93 @@ +'use strict'; +const os = require('os'); + +class Defaults{ + constructor(){ + const IPType=os.networkInterfaces()[ + Object.keys(os.networkInterfaces())[0] + ][0].family; + + Object.defineProperties( + this, + { + appspace : { + enumerable:true, + writable:true, + value:'app.' + }, + socketRoot : { + enumerable:true, + writable:true, + value:'/tmp/' + }, + networkHost : { + enumerable:true, + writable:true, + value:(IPType=='IPv6')? '::1' : '127.0.0.1' + }, + networkPort : { + enumerable:true, + writable:true, + value:8000 + }, + id : { + enumerable:true, + writable:true, + value:os.hostname() + }, + encoding : { + enumerable:true, + writable:true, + value:'utf8' + }, + rawBuffer : { + enumerable:true, + writable:true, + value:false + }, + sync : { + enumerable:true, + writable:true, + value:false + }, + silent : { + enumerable:true, + writable:true, + value:false + }, + maxConnections : { + enumerable:true, + writable:true, + value:100 + }, + retry : { + enumerable:true, + writable:true, + value:500 + }, + maxRetries : { + enumerable:true, + writable:true, + value:Infinity + }, + stopRetrying : { + enumerable:true, + writable:true, + value:false + }, + IPType : { + enumerable:true, + writable:true, + value:IPType + }, + tls : { + enumerable:true, + writable:true, + value:false + } + } + ); + } +} + +module.exports=Defaults; diff --git a/entities/LogColors.js b/entities/LogColors.js new file mode 100644 index 0000000..92412ae --- /dev/null +++ b/entities/LogColors.js @@ -0,0 +1,15 @@ +'use strict'; + +class LogColors{ + constructor(){ + this.good='green'; + this.notice='yellow'; + this.warn='red'; + this.error='redBG'; + this.debug='magenta'; + this.variable='cyan'; + this.data='blue'; + } +} + +module.exports=LogColors; diff --git a/node-ipc.js b/node-ipc.js index 522d5bb..728451f 100644 --- a/node-ipc.js +++ b/node-ipc.js @@ -1,319 +1,25 @@ 'use strict'; -const os = require('os'), - util = require('util'), - colors = require('colors'), - Client = require('./lib/client.js'), - Server = require('./lib/socketServer.js'); +const colors = require('colors'), + LogColors = require('./entities/LogColors.js'), + IPC = require('./services/IPC.js'); -colors.setTheme( - { - good : 'green', - notice : 'yellow', - warn : 'red', - error : 'redBG', - debug : 'magenta', - variable: 'cyan', - data : 'blue' +class IPCModule extends IPC{ + constructor(){ + super(); + Object.defineProperty( + this, + 'IPC', + { + enumerable:true, + writable:false, + value:IPC + } + ) } -); - -const IPType=os.networkInterfaces()[ - Object.keys(os.networkInterfaces())[0] -][0].family; - -let defaults={ - appspace : 'app.', - socketRoot : '/tmp/', - networkHost : (IPType=='IPv6')? '::1' : '127.0.0.1', - networkPort : 8000, - id : os.hostname(), - encoding : 'utf8', - rawBuffer : false, - sync : false, - silent : false, - maxConnections : 100, - retry : 500, - maxRetries : Infinity, - stopRetrying : false, - IPType : IPType, - tls : false -}; - -let ipc = { - config : defaults, - connectTo : connect, - connectToNet: connectNet, - disconnect : disconnect, - serve : serve, - serveNet : serveNet, - of : {}, - server : false, - log : log -}; - -function log(){ - if(ipc.config.silent){ - return; - } - - let args=Array.prototype.slice.call(arguments); - - for(let i=0, count=args.length; i
- 67.49% + 68.59% Statements - 272/403 + 286/417
56.37% @@ -30,14 +30,14 @@ 115/204
- 86.84% + 88.1% Functions - 33/38 + 37/42
- 67.49% + 68.59% Lines - 272/403 + 286/417
@@ -59,20 +59,20 @@ - node-ipc/ -
- 66.91% - 91/136 - 59.72% - 43/72 - 85.71% - 6/7 - 66.91% - 91/136 + node-ipc/ +
+ 100% + 5/5 + 100% + 0/0 + 100% + 1/1 + 100% + 5/5 - node-ipc/lib/ + node-ipc/dao/
67.79% 181/267 @@ -84,13 +84,39 @@ 181/267 + + node-ipc/entities/ +
+ 100% + 12/12 + 50% + 1/2 + 100% + 2/2 + 100% + 12/12 + + + + node-ipc/services/ +
+ 66.17% + 88/133 + 60% + 42/70 + 87.5% + 7/8 + 66.17% + 88/133 + +
diff --git a/spec/coverage/lcov-report/node-ipc/dao/client.js.html b/spec/coverage/lcov-report/node-ipc/dao/client.js.html new file mode 100644 index 0000000..9b24480 --- /dev/null +++ b/spec/coverage/lcov-report/node-ipc/dao/client.js.html @@ -0,0 +1,773 @@ + + + + Code coverage report for node-ipc/dao/client.js + + + + + + + +
+
+

+ all files / node-ipc/dao/ client.js +

+
+
+ 72.82% + Statements + 75/103 +
+
+ 52.38% + Branches + 22/42 +
+
+ 100% + Functions + 10/10 +
+
+ 72.82% + Lines + 75/103 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237  +  + +  +  +  +  +  +  +  + + +  +  +  +  +  +  +  +  +  + +  + +  +  + + +  + + + +  + +  +  + +  +  + + + +  +  + +  +  +  +  + + + +  +  + +  +13× +  +13× +13× +  +  +  +  +13× + +  + +  + +  +  +  +  + +  +  +  +  +  + + + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +13× +  +13× +  +  +10× +10× +  +  +  +  +13× +  +  + + + +  +  +  +13× +  +  +13× +  +13× +  +  +  + + +  +  +  +  +  + + + +  + +  +  + +  + +  + + + + +  + + +  +  +  +  +  +  +  +  + +  +  +  +13× +  +  + + +  +  +  +  +  +  +  +  +  +  +  +  + + +  +  + +  + +  +  +  +  + +  + + + + + +  + + +  +  +  +  +  + +  +  +  + +  +  +  +  + + 
'use strict';
+ 
+const net = require('net'),
+    tls = require('tls'),
+    eventParser = require('./eventParser.js'),
+    Pubsub = require('event-pubsub'),
+    Message = require('js-message'),
+    fs = require('fs'),
+    Queue = require('js-queue');
+ 
+function init(config,log){
+    let client={
+        config  : config,
+        queue   : new Queue,
+        socket  : false,
+        connect : connect,
+        emit    : emit,
+        log     : log,
+        retriesRemaining:config.maxRetries||0
+    };
+ 
+    new Pubsub(client);
+ 
+    return client;
+}
+ 
+function emit(type,data){
+    this.log('dispatching event to '.debug, this.id.variable, this.path.variable,' : ', type.data,',', data);
+ 
+    let message=new Message;
+    message.type=type;
+    message.data=data;
+ 
+    Iif(this.config.rawBuffer){
+        message=new Buffer(type,this.encoding);
+    }else{
+        message=eventParser.format(message);
+    }
+ 
+    if(!this.config.sync){
+        this.socket.write(message);
+        return;
+    }
+ 
+    this.queue.add(
+        syncEmit.bind(this,message)
+    );
+}
+ 
+function syncEmit(message){
+    this.log('dispatching event to '.debug, this.id.variable, this.path.variable,' : ', message.data);
+    this.socket.write(message);
+}
+ 
+function connect(){
+    //init client object for scope persistance especially inside of socket events.
+    let client=this;
+ 
+    client.log('requested connection to '.debug, client.id.variable, client.path.variable);
+    Iif(!this.path){
+        client.log('\n\n######\nerror: '.error, client.id .info,' client has not specified socket path it wishes to connect to.'.error);
+        return;
+    }
+ 
+    if(!client.port){
+        client.log('Connecting client on Unix Socket :'.debug, client.path.variable);
+ 
+        let path = client.path;
+ 
+        Iif (process.platform ==='win32' && !client.path.startsWith('\\\\.\\pipe\\')){
+            path = path.replace(/^\//, '');
+            path = path.replace(/\//g, '-');
+            path= '\\\\.\\pipe\\'+path;
+        }
+        client.socket = net.connect(
+            {
+                path: path
+            }
+        );
+    }else{
+        Eif(!client.config.tls){
+            client.log('Connecting client via TCP to'.debug, client.path.variable ,client.port);
+            client.socket = net.connect(
+                {
+                    port:client.port,
+                    host:client.path
+                }
+            );
+        }else{
+            client.log('Connecting client via TLS to'.debug, client.path.variable ,client.port,client.config.tls);
+            if(client.config.tls.private){
+                client.config.tls.key=fs.readFileSync(client.config.tls.private);
+            }
+            if(client.config.tls.public){
+                client.config.tls.cert=fs.readFileSync(client.config.tls.public);
+            }
+            if(client.config.tls.trustedConnections){
+                if(typeof client.config.tls.trustedConnections === 'string'){
+                    client.config.tls.trustedConnections=[client.config.tls.trustedConnections];
+                }
+                client.config.tls.ca=[];
+                for(let i=0; i<client.config.tls.trustedConnections.length; i++){
+                    client.config.tls.ca.push(
+                        fs.readFileSync(client.config.tls.trustedConnections[i])
+                    );
+                }
+            }
+ 
+            client.config.tls.host=client.path;
+            client.config.tls.port=client.port;
+ 
+            client.socket = tls.connect(
+                client.config.tls
+            );
+        }
+    }
+ 
+    client.socket.setEncoding(this.config.encoding);
+ 
+    client.socket.on(
+        'error',
+        function(err){
+            client.log('\n\n######\nerror: '.error, err);
+            client.trigger('error', err);
+ 
+        }
+    );
+ 
+    client.socket.on(
+        'connect',
+        function connectionMade(){
+            client.trigger('connect');
+            client.retriesRemaining=client.config.maxRetries;
+            client.log('retrying reset');
+        }
+    );
+ 
+    client.socket.on(
+        'close',
+        function connectionClosed(){
+            client.log('connection closed'.notice ,client.id.variable , client.path.variable, client.retriesRemaining+' tries remaining of '+client.config.maxRetries);
+ 
+            if(
+                client.config.stopRetrying || client.retriesRemaining<1
+ 
+            ){
+                client.trigger('disconnect');
+                client.log(
+                    client.config.id.variable,
+                    'exceeded connection rety amount of'.warn,
+                    ' or stopRetrying flag set.'
+                );
+ 
+                client.socket.destroy();
+                client.trigger('destroy');
+                client=undefined;
+ 
+                return;
+            }
+ 
+            client.isRetrying=true;
+ 
+            setTimeout(
+                function retryTimeout(){
+                    client.retriesRemaining--;
+                    client.isRetrying=false;
+                    client.connect();
+                    setTimeout(
+                        function resetRetriesCheck(){
+                            if(!client.isRetrying){
+                                client.retriesRemaining=client.config.maxRetries;
+                            }
+                        },
+                        100
+                    );
+                }.bind(null,client),
+                client.config.retry
+            );
+ 
+            client.trigger('disconnect');
+        }
+    );
+ 
+    client.socket.on(
+        'data',
+        function(data) {
+            client.log('## recieved events ##'.rainbow);
+            Iif(client.config.rawBuffer){
+                client.trigger(
+                   'data',
+                   new Buffer(data,this.encoding)
+                );
+                if(!client.config.sync){
+                    return;
+                }
+ 
+                client.queue.next();
+                return;
+            }
+ 
+            Eif(!this.ipcBuffer){
+                this.ipcBuffer='';
+            }
+ 
+            data=(this.ipcBuffer+=data);
+ 
+            Iif(data.slice(-1)!=eventParser.delimiter || data.indexOf(eventParser.delimiter) == -1){
+                client.log('Implementing larger buffer for this socket message. You may want to consider smaller messages'.notice);
+                return;
+            }
+ 
+            this.ipcBuffer='';
+ 
+            const events = eventParser.parse(data);
+            const eCount = events.length;
+            for(let i=0; i<eCount; i++){
+                let message=new Message;
+                message.load(events[i]);
+ 
+                client.log('detected event of type '.debug, message.type.data, message.data);
+                client.trigger(
+                   message.type,
+                   message.data
+                );
+            }
+ 
+            Iif(!client.config.sync){
+                return;
+            }
+ 
+            client.queue.next();
+        }
+    );
+}
+ 
+module.exports=init;
+ 
+
+
+ + + + + + + diff --git a/spec/coverage/lcov-report/node-ipc/dao/eventParser.js.html b/spec/coverage/lcov-report/node-ipc/dao/eventParser.js.html new file mode 100644 index 0000000..83b05a9 --- /dev/null +++ b/spec/coverage/lcov-report/node-ipc/dao/eventParser.js.html @@ -0,0 +1,146 @@ + + + + Code coverage report for node-ipc/dao/eventParser.js + + + + + + + +
+
+

+ all files / node-ipc/dao/ eventParser.js +

+
+
+ 84.62% + Statements + 11/13 +
+
+ 50% + Branches + 2/4 +
+
+ 100% + Functions + 2/2 +
+
+ 84.62% + Lines + 11/13 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28  +  + +  +  +  +  +  + + +  +  + +  +  +  + + +  +  + + + + +  +  + + 
'use strict';
+ 
+const parser={
+    parse       : parseDataEvents,
+    format      : formatData,
+    delimiter   : '\f'
+};
+ 
+function formatData(message){
+    Iif(!message.data){
+        message.data={};
+    }
+    Iif(message.data['_maxListeners']){
+        message.data={};
+    }
+ 
+    message=message.JSON+parser.delimiter;
+    return message;
+}
+ 
+function parseDataEvents(data){
+    let events=data.split(parser.delimiter);
+    events.pop();
+    return events;
+}
+ 
+module.exports=parser;
+ 
+
+
+ + + + + + + diff --git a/spec/coverage/lcov-report/node-ipc/dao/index.html b/spec/coverage/lcov-report/node-ipc/dao/index.html new file mode 100644 index 0000000..23c06fe --- /dev/null +++ b/spec/coverage/lcov-report/node-ipc/dao/index.html @@ -0,0 +1,119 @@ + + + + Code coverage report for node-ipc/dao/ + + + + + + + +
+
+

+ all files node-ipc/dao/ +

+
+
+ 67.79% + Statements + 181/267 +
+
+ 54.55% + Branches + 72/132 +
+
+ 87.1% + Functions + 27/31 +
+
+ 67.79% + Lines + 181/267 +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
client.js
72.82%75/10352.38%22/42100%10/1072.82%75/103
eventParser.js
84.62%11/1350%2/4100%2/284.62%11/13
socketServer.js
62.91%95/15155.81%48/8678.95%15/1962.91%95/151
+
+
+ + + + + + + diff --git a/spec/coverage/lcov-report/node-ipc/dao/socketServer.js.html b/spec/coverage/lcov-report/node-ipc/dao/socketServer.js.html new file mode 100644 index 0000000..c16ef90 --- /dev/null +++ b/spec/coverage/lcov-report/node-ipc/dao/socketServer.js.html @@ -0,0 +1,1172 @@ + + + + Code coverage report for node-ipc/dao/socketServer.js + + + + + + + +
+
+

+ all files / node-ipc/dao/ socketServer.js +

+
+
+ 62.91% + Statements + 95/151 +
+
+ 55.81% + Branches + 48/86 +
+
+ 78.95% + Functions + 15/19 +
+
+ 62.91% + Lines + 95/151 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 +328 +329 +330 +331 +332 +333 +334 +335 +336 +337 +338 +339 +340 +341 +342 +343 +344 +345 +346 +347 +348 +349 +350 +351 +352 +353 +354 +355 +356 +357 +358 +359 +360 +361 +362 +363 +364 +365 +366 +367 +368 +369 +370  +  + +  +  +  +  +  +  +  + + +  + + + +  + +  +  + +  +  + +  + +  +  +  +  +  + +  +  +  + +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + + +  +  +  +  +  +  +  +  +  +  +  + +  +  +  +  +  + +  +  + +  +  +  +  + +  +  + +  + + + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + + + +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  + +  +  + + +  +  + +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  + +  + + +  + + +  +  + + +  +  + +  +  +  +  +  +  + +  +  +  +  +  +  +  +  + +  +  + + +  +  +  +  +  +  +  +  +  + + +  +  + +  + +  +  +  +  + +  + +  + + + +  + +  + + +  + +  +  +  +  +  +  +  +  + +  +  + +  +  +  + + +  + +  +  + +  + +  +  +  + +  +  +  +  + +  +  +  +  + + +  +  + + + +  +  +  +  +  + +  +  +  +  + +  +  + + + +  +  +  +  + +  +  + + +  +  +  +  + +  +  +  +  +  +  +  +  +  +  + +  + +  +  + + + +  + + +  +  +  +  + +  +  +  + +  + +  +  +  + +  + +  + +  +  +  +  + +  +  + + 
'use strict';
+ 
+const net = require('net'),
+    tls = require('tls'),
+    fs = require('fs'),
+    dgram = require('dgram'),
+    eventParser = require('./eventParser.js'),
+    Pubsub = require('event-pubsub'),
+    Message = require('js-message');
+ 
+function emit(socket, type, data){
+    this.log('dispatching event to socket'.debug, ' : ', type.data, data);
+ 
+    let message=new Message;
+    message.type=type;
+    message.data=data;
+ 
+    Iif(this.config.rawBuffer){
+        message=new Buffer(type,this.encoding);
+    }else{
+        message=eventParser.format(message);
+    }
+ 
+    Eif(this.udp4 || this.udp6){
+ 
+        Iif(!socket.address || !socket.port){
+            this.log('Attempting to emit to a single UDP socket without supplying socket address or port. Redispatching event as broadcast to all connected sockets');
+            this.broadcast(type,data);
+            return;
+        }
+ 
+        this.server.write(
+            message,
+            socket
+        );
+        return;
+    }
+ 
+    socket.write(message);
+}
+ 
+function broadcast(type,data){
+    this.log('broadcasting event to all known sockets listening to '.debug, this.path.variable,' : ', ((this.port)?this.port:''), type, data);
+    let message=new Message;
+    message.type=type;
+    message.data=data;
+ 
+    if(this.config.rawBuffer){
+        message=new Buffer(type,this.encoding);
+    }else{
+        message=eventParser.format(message);
+    }
+ 
+    if(this.udp4 || this.udp6){
+        for(let i=1, count=this.sockets.length; i<count; i++){
+            this.server.write(message,this.sockets[i]);
+        }
+    }else{
+        for(let i=0, count=this.sockets.length; i<count; i++){
+            this.sockets[i].write(message);
+        }
+    }
+}
+ 
+function init(path,config,log,port){
+    let server={
+        config          : config,
+        path            : path,
+        port            : port,
+        udp4            : false,
+        udp6            : false,
+        log             : log,
+        server          : false,
+        sockets         : [],
+        emit            : emit,
+        broadcast       : broadcast,
+        onStart         : function onStart(socket){
+            this.trigger(
+                'start',
+                socket
+            );
+        },
+        stop:function stop(){
+            server.server.close();
+        },
+        start           : function start(){
+            Iif(!this.path){
+                server.log('Socket Server Path not specified, refusing to start'.warn);
+                return;
+            }
+ 
+            fs.unlink(
+                this.path,
+                function () {
+                    server.log('starting server on '.debug,server.path.variable,((server.port)?':'+server.port:'').variable);
+ 
+                    if(!server.udp4 && !server.udp6){
+                        Eif(!server.config.tls){
+                            server.server=net.createServer(
+                                serverCreated
+                            );
+                        }else{
+                            server.log('starting TLS server'.debug,server.config.tls);
+                            if(server.config.tls.private){
+                                server.config.tls.key=fs.readFileSync(server.config.tls.private);
+                            }else{
+                                server.config.tls.key=fs.readFileSync(__dirname+'/../local-node-ipc-certs/private/server.key');
+                            }
+                            if(server.config.tls.public){
+                                server.config.tls.cert=fs.readFileSync(server.config.tls.public);
+                            }else{
+                                server.config.tls.cert=fs.readFileSync(__dirname+'/../local-node-ipc-certs/server.pub');
+                            }
+                            if(server.config.tls.dhparam){
+                                server.config.tls.dhparam=fs.readFileSync(server.config.tls.dhparam);
+                            }
+                            if(server.config.tls.trustedConnections){
+                                if(typeof server.config.tls.trustedConnections === 'string'){
+                                    server.config.tls.trustedConnections=[server.config.tls.trustedConnections];
+                                }
+                                server.config.tls.ca=[];
+                                for(let i=0; i<server.config.tls.trustedConnections.length; i++){
+                                    server.config.tls.ca.push(
+                                        fs.readFileSync(server.config.tls.trustedConnections[i])
+                                    );
+                                }
+                            }
+                            server.server=tls.createServer(
+                                server.config.tls,
+                                serverCreated
+                            );
+                        }
+                    }else{
+                        function UDPWrite(message,socket){
+                            let data=new Buffer(message, server.config.encoding);
+                            server.server.send(
+                                data,
+                                0,
+                                data.length,
+                                socket.port,
+                                socket.address,
+                                function(err, bytes) {
+                                    Iif(err){
+                                        server.log('error writing data to socket'.warn,err);
+                                        server.trigger(
+                                            'error',
+                                            function(err){
+                                                server.trigger('error',err);
+                                            }
+                                        );
+                                    }
+                                }
+                            );
+                        }
+ 
+                        server.server=dgram.createSocket(
+                            ((server.udp4)? 'udp4':'udp6')
+                        );
+                        server.server.write=UDPWrite;
+                        server.server.on(
+                            'listening',
+                            function () {
+                                serverCreated(server.server);
+                            }
+                        );
+                    }
+ 
+                    server.server.on(
+                        'error',
+                        function(err){
+                            server.log('server error'.warn,err);
+ 
+                            server.trigger(
+                                'error',
+                                err
+                            );
+                        }
+                    );
+ 
+                    server.server.maxConnections=server.config.maxConnections;
+ 
+                    function serverCreated(socket) {
+                        server.sockets.push(socket);
+ 
+                        if(socket.setEncoding){
+                            socket.setEncoding(server.config.encoding);
+                        }
+ 
+                        server.log('## socket connection to server detected ##'.rainbow);
+                        socket.on(
+                            'close',
+                            function(socket){
+                                server.trigger(
+                                    'close',
+                                    socket
+                                );
+                            }
+                        );
+ 
+                        socket.on(
+                            'error',
+                            function(err){
+                                server.log('server socket error'.warn,err);
+ 
+                                server.trigger('error',err);
+                            }
+                        );
+ 
+                        socket.on(
+                            'data',
+                            function(data,UDPSocket){
+                                let sock=((server.udp4 || server.udp6)? UDPSocket : socket);
+                                Iif(server.config.rawBuffer){
+                                    data=new Buffer(data,this.encoding);
+                                    server.trigger(
+                                        'data',
+                                        data,
+                                        sock
+                                    );
+                                    return;
+                                }
+ 
+                                Eif(!this.ipcBuffer){
+                                    this.ipcBuffer='';
+                                }
+ 
+                                data=(this.ipcBuffer+=data);
+ 
+                                Iif(data.slice(-1)!=eventParser.delimiter || data.indexOf(eventParser.delimiter) == -1){
+                                    server.log('Implementing larger buffer for this socket message. You may want to consider smaller messages'.notice);
+                                    return;
+                                }
+ 
+                                this.ipcBuffer='';
+ 
+                                data=eventParser.parse(data);
+ 
+                                while(data.length>0){
+                                    let message=new Message;
+                                    message.load(data.shift());
+ 
+                                    server.log('received event of : '.debug,message.type.data,message.data);
+ 
+                                    Eif(message.data.id)
+                                        sock.id=message.data.id;
+ 
+                                    server.trigger(
+                                        message.type,
+                                        message.data,
+                                        sock
+                                    );
+                                }
+                            }
+                        );
+ 
+                        socket.on(
+                            'message',
+                            function(msg,rinfo) {
+                                Iif (!rinfo){
+                                    return;
+                                }
+ 
+                                server.log('Received UDP message from '.debug, rinfo.address.variable, rinfo.port);
+                                let data;
+ 
+                                Iif(server.config.rawSocket){
+                                    data=new Buffer(msg,this.encoding);
+                                }else{
+                                    data=msg.toString();
+                                }
+                                socket.emit('data',data,rinfo);
+                            }
+                        );
+ 
+                        server.trigger(
+                            'connect',
+                            socket
+                        );
+ 
+                        Iif(server.config.rawBuffer){
+                            return;
+                        }
+                    }
+ 
+                    function started(socket){
+                        server.onStart(socket);
+                    }
+ 
+                    if(!port){
+                        server.log('starting server as'.debug, 'Unix || Windows Socket'.variable);
+                        Iif (process.platform ==='win32'){
+    						                                                server.path = server.path.replace(/^\//, '');
+    						                                                server.path = server.path.replace(/\//g, '-');
+    						                                                server.path= '\\\\.\\pipe\\'+server.path;
+						                                                }
+ 
+                        server.server.listen(
+                            server.path,
+                            started
+                        );
+ 
+                        return;
+                    }
+ 
+                    if(!server.udp4 && !server.udp6){
+                        server.log('starting server as'.debug, (server.config.tls?'TLS':'TCP').variable);
+                        server.server.listen(
+                            server.port,
+                            server.path,
+                            started
+                        );
+                        return;
+                    }
+ 
+                    server.log('starting server as'.debug,((server.udp4)? 'udp4':'udp6').variable);
+                    server.server.bind(
+                        server.port,
+                        server.path
+                    );
+ 
+                    started(
+                        {
+                            address : server.path,
+                            port    : server.port
+                        }
+                    );
+                }
+            );
+        }
+    };
+ 
+    new Pubsub(server);
+ 
+    server.on(
+        'close',
+        function(){
+            for(let i=0, count=server.sockets.length; i<count; i++){
+                let socket=server.sockets[i];
+                let destroyedSocketId=false;
+ 
+                Eif(socket){
+                    Iif(socket.readable){
+                        continue;
+                    }
+                }
+ 
+                Iif(socket.id){
+                    destroyedSocketId=socket.id;
+                }
+ 
+                server.log('socket disconnected'.notice,' '+destroyedSocketId.variable);
+ 
+                Iif(socket && socket.destroy){
+                    socket.destroy();
+                }
+ 
+                server.sockets.splice(i,1);
+ 
+                server.trigger('socket.disconnected', socket, destroyedSocketId);
+ 
+                return;
+            }
+        }
+    );
+ 
+    return server;
+}
+ 
+module.exports=init;
+ 
+
+
+ + + + + + + diff --git a/spec/coverage/lcov-report/node-ipc/entities/Defaults.js.html b/spec/coverage/lcov-report/node-ipc/entities/Defaults.js.html new file mode 100644 index 0000000..e2a7c05 --- /dev/null +++ b/spec/coverage/lcov-report/node-ipc/entities/Defaults.js.html @@ -0,0 +1,344 @@ + + + + Code coverage report for node-ipc/entities/Defaults.js + + + + + + + +
+
+

+ all files / node-ipc/entities/ Defaults.js +

+
+
+ 100% + Statements + 4/4 +
+
+ 50% + Branches + 1/2 +
+
+ 100% + Functions + 1/1 +
+
+ 100% + Lines + 4/4 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94  + +  +  +  + +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + + 
'use strict';
+const os = require('os');
+ 
+class Defaults{
+    constructor(){
+        const IPType=os.networkInterfaces()[
+            Object.keys(os.networkInterfaces())[0]
+        ][0].family;
+ 
+        Object.defineProperties(
+            this,
+            {
+                appspace        : {
+                    enumerable:true,
+                    writable:true,
+                    value:'app.'
+                },
+                socketRoot      : {
+                    enumerable:true,
+                    writable:true,
+                    value:'/tmp/'
+                },
+                networkHost     : {
+                    enumerable:true,
+                    writable:true,
+                    value:(IPType=='IPv6')? '::1' : '127.0.0.1'
+                },
+                networkPort     : {
+                    enumerable:true,
+                    writable:true,
+                    value:8000
+                },
+                id              : {
+                    enumerable:true,
+                    writable:true,
+                    value:os.hostname()
+                },
+                encoding        : {
+                    enumerable:true,
+                    writable:true,
+                    value:'utf8'
+                },
+                rawBuffer       : {
+                    enumerable:true,
+                    writable:true,
+                    value:false
+                },
+                sync            : {
+                    enumerable:true,
+                    writable:true,
+                    value:false
+                },
+                silent          : {
+                    enumerable:true,
+                    writable:true,
+                    value:false
+                },
+                maxConnections  : {
+                    enumerable:true,
+                    writable:true,
+                    value:100
+                },
+                retry           : {
+                    enumerable:true,
+                    writable:true,
+                    value:500
+                },
+                maxRetries      : {
+                    enumerable:true,
+                    writable:true,
+                    value:Infinity
+                },
+                stopRetrying    : {
+                    enumerable:true,
+                    writable:true,
+                    value:false
+                },
+                IPType          : {
+                    enumerable:true,
+                    writable:true,
+                    value:IPType
+                },
+                tls             : {
+                    enumerable:true,
+                    writable:true,
+                    value:false
+                }
+            }
+        );
+    }
+}
+ 
+module.exports=Defaults;
+ 
+
+
+ + + + + + + diff --git a/spec/coverage/lcov-report/node-ipc/entities/LogColors.js.html b/spec/coverage/lcov-report/node-ipc/entities/LogColors.js.html new file mode 100644 index 0000000..7964a1f --- /dev/null +++ b/spec/coverage/lcov-report/node-ipc/entities/LogColors.js.html @@ -0,0 +1,110 @@ + + + + Code coverage report for node-ipc/entities/LogColors.js + + + + + + + +
+
+

+ all files / node-ipc/entities/ LogColors.js +

+
+
+ 100% + Statements + 8/8 +
+
+ 100% + Branches + 0/0 +
+
+ 100% + Functions + 1/1 +
+
+ 100% + Lines + 8/8 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16  +  +  +  + + + + + + + +  +  +  + + 
'use strict';
+ 
+class LogColors{
+    constructor(){
+        this.good='green';
+        this.notice='yellow';
+        this.warn='red';
+        this.error='redBG';
+        this.debug='magenta';
+        this.variable='cyan';
+        this.data='blue';
+    }
+}
+ 
+module.exports=LogColors;
+ 
+
+
+ + + + + + + diff --git a/spec/coverage/lcov-report/node-ipc/entities/index.html b/spec/coverage/lcov-report/node-ipc/entities/index.html new file mode 100644 index 0000000..72d8dc2 --- /dev/null +++ b/spec/coverage/lcov-report/node-ipc/entities/index.html @@ -0,0 +1,106 @@ + + + + Code coverage report for node-ipc/entities/ + + + + + + + +
+
+

+ all files node-ipc/entities/ +

+
+
+ 100% + Statements + 12/12 +
+
+ 50% + Branches + 1/2 +
+
+ 100% + Functions + 2/2 +
+
+ 100% + Lines + 12/12 +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
Defaults.js
100%4/450%1/2100%1/1100%4/4
LogColors.js
100%8/8100%0/0100%1/1100%8/8
+
+
+ + + + + + + diff --git a/spec/coverage/lcov-report/node-ipc/index.html b/spec/coverage/lcov-report/node-ipc/index.html index 3a1a180..8311d7f 100644 --- a/spec/coverage/lcov-report/node-ipc/index.html +++ b/spec/coverage/lcov-report/node-ipc/index.html @@ -20,28 +20,28 @@
- 66.91% + 100% Statements - 91/136 + 5/5
- 59.72% + 100% Branches - 43/72 + 0/0
- 85.71% + 100% Functions - 6/7 + 1/1
- 66.91% + 100% Lines - 91/136 + 5/5
-
+
@@ -59,16 +59,16 @@ - - - - - - - - - - + + + + + + + + + + @@ -77,7 +77,7 @@ diff --git a/spec/coverage/lcov-report/node-ipc/node-ipc.js.html b/spec/coverage/lcov-report/node-ipc/node-ipc.js.html index 6617d77..3440436 100644 --- a/spec/coverage/lcov-report/node-ipc/node-ipc.js.html +++ b/spec/coverage/lcov-report/node-ipc/node-ipc.js.html @@ -20,28 +20,28 @@
- 66.91% + 100% Statements - 91/136 + 5/5
- 59.72% + 100% Branches - 43/72 + 0/0
- 85.71% + 100% Functions - 6/7 + 1/1
- 66.91% + 100% Lines - 91/136 + 5/5
-
+
node-ipc.js
66.91%91/13659.72%43/7285.71%6/766.91%91/136node-ipc.js
100%5/5100%0/0100%1/1100%5/5
1 2 @@ -68,301 +68,7 @@ 23 24 25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158 -159 -160 -161 -162 -163 -164 -165 -166 -167 -168 -169 -170 -171 -172 -173 -174 -175 -176 -177 -178 -179 -180 -181 -182 -183 -184 -185 -186 -187 -188 -189 -190 -191 -192 -193 -194 -195 -196 -197 -198 -199 -200 -201 -202 -203 -204 -205 -206 -207 -208 -209 -210 -211 -212 -213 -214 -215 -216 -217 -218 -219 -220 -221 -222 -223 -224 -225 -226 -227 -228 -229 -230 -231 -232 -233 -234 -235 -236 -237 -238 -239 -240 -241 -242 -243 -244 -245 -246 -247 -248 -249 -250 -251 -252 -253 -254 -255 -256 -257 -258 -259 -260 -261 -262 -263 -264 -265 -266 -267 -268 -269 -270 -271 -272 -273 -274 -275 -276 -277 -278 -279 -280 -281 -282 -283 -284 -285 -286 -287 -288 -289 -290 -291 -292 -293 -294 -295 -296 -297 -298 -299 -300 -301 -302 -303 -304 -305 -306 -307 -308 -309 -310 -311 -312 -313 -314 -315 -316 -317 -318 -319 -320  +26      @@ -371,21 +77,6 @@     -  -  -  -  -  -  -  -  -  -  -  - -  -  -      @@ -399,614 +90,41 @@       -  -  -  -  -    -  -  -  -  -  -  -  -  -  -  - -114× -  -  -  -114× -  -114× -346× -318× -  -  -28× -  -  -114× -  -  -  -  - - -  -  -  - -  - - - - -  -  -  - -  -  - - -  -  -  - -  -  -  -  -  -  -  -  - -  -  -  - -  -  -  -  -  - -  -  -  -  -  - -  -  -  - - - - - - -  - - - - - -  - - -  -  -  -  - -  - -  -  -  -  -  -  - -  -  -  -  - -  -  -  -  - - -  -  -  -  - -  -  - -  -  -  -  - -  -  -  - -  -  -  -  -  -  - - -  -  - -  -  -  -  -  - - - - -  -  - -  -  -  - -  -  -  -  -  -  -  - - -  -  -  -  - -  -  - -  -  -  -  -  -  -  -  -  -  -  -  - - - -  - -  - -  -  - - -  -  -  -  -  -  - - - - -  - -  -  -  -  - - -  -  -  -  - -  -  - -  -  -  - -  -  -  -  -  -  -  -  - -  -  -  - -  -  -  - -  -  -  -  -  -  -  -  -  -  -  -  - - - - -  - -  - -  -   
'use strict';
  
-const os = require('os'),
-    util = require('util'),
-    colors = require('colors'),
-    Client = require('./lib/client.js'),
-    Server = require('./lib/socketServer.js');
+const colors = require('colors'),
+    LogColors = require('./entities/LogColors.js'),
+    IPC = require('./services/IPC.js');
  
-colors.setTheme(
-    {
-        good    : 'green',
-        notice  : 'yellow',
-        warn    : 'red',
-        error   : 'redBG',
-        debug   : 'magenta',
-        variable: 'cyan',
-        data    : 'blue'
+class IPCModule extends IPC{
+    constructor(){
+        super();
+        Object.defineProperty(
+            this,
+            'IPC',
+            {
+                enumerable:true,
+                writable:false,
+                value:IPC
+            }
+        )
     }
-);
- 
-const IPType=os.networkInterfaces()[
-    Object.keys(os.networkInterfaces())[0]
-][0].family;
- 
-let defaults={
-    appspace        : 'app.',
-    socketRoot      : '/tmp/',
-    networkHost     : (IPType=='IPv6')? '::1' : '127.0.0.1',
-    networkPort     : 8000,
-    id              : os.hostname(),
-    encoding        : 'utf8',
-    rawBuffer       : false,
-    sync            : false,
-    silent          : false,
-    maxConnections  : 100,
-    retry           : 500,
-    maxRetries      : Infinity,
-    stopRetrying    : false,
-    IPType          : IPType,
-    tls             : false
-};
- 
-let ipc = {
-    config      : defaults,
-    connectTo   : connect,
-    connectToNet: connectNet,
-    disconnect  : disconnect,
-    serve       : serve,
-    serveNet    : serveNet,
-    of          : {},
-    server      : false,
-    log         : log
-};
- 
-function log(){
-    Iif(ipc.config.silent){
-        return;
-    }
- 
-    let args=Array.prototype.slice.call(arguments);
- 
-    for(let i=0, count=args.length; i<count; i++){
-        if(typeof args[i] != 'object'){
-            continue;
-        }
- 
-        args[i]=util.inspect(args[i],{colors:true});
-    }
- 
-    console.log(
-        args.join(' ')
-    );
 }
  
-function disconnect(id){
-    Iif(!ipc.of[id]){
-        return;
-    }
  
-    ipc.of[id].config.stopRetrying=true;
+colors.setTheme(new LogColors);
  
-    ipc.of[id].off('*');
-    Eif(ipc.of[id].socket){
-        Eif(ipc.of[id].socket.destroy){
-            ipc.of[id].socket.destroy();
-        }
-    }
- 
-    delete ipc.of[id];
-}
- 
-function serve(path,callback){
-    Iif(typeof path=='function'){
-        callback=path;
-        path=false;
-    }
-    Iif(!path){
-        ipc.log(
-            'Server path not specified, so defaulting to'.notice,
-            'ipc.config.socketRoot + ipc.config.appspace + ipc.config.id'.variable,
-            (ipc.config.socketRoot+ipc.config.appspace+ipc.config.id).data
-        );
-        path=ipc.config.socketRoot+ipc.config.appspace+ipc.config.id;
-    }
- 
-    Iif(!callback){
-        callback=emptyCallback;
-    }
- 
-    ipc.server=new Server(
-        path,
-        ipc.config,
-        log
-    );
- 
-    ipc.server.on(
-        'start',
-        callback
-    );
-}
- 
-function emptyCallback(){
-    //Do Nothing
-}
- 
-function serveNet(host,port,UDPType,callback){
-    if(typeof host=='number'){
-        callback=UDPType;
-        UDPType=port;
-        port=host;
-        host=false;
-    }
-    if(typeof host=='function'){
-        callback=host;
-        UDPType=false;
-        host=false;
-        port=false;
-    }
-    if(!host){
-        ipc.log(
-            'Server host not specified, so defaulting to'.notice,
-            'ipc.config.networkHost'.variable,
-            ipc.config.networkHost.data
-        );
-        host=ipc.config.networkHost;
-    }
-    Iif(host.toLowerCase()=='udp4' || host.toLowerCase()=='udp6'){
-        callback=port;
-        UDPType=host.toLowerCase();
-        port=false;
-        host=ipc.config.networkHost;
-    }
- 
-    Iif(typeof port=='string'){
-        callback=UDPType;
-        UDPType=port;
-        port=false;
-    }
-    Iif(typeof port=='function'){
-        callback=port;
-        UDPType=false;
-        port=false;
-    }
-    if(!port){
-        ipc.log(
-            'Server port not specified, so defaulting to'.notice,
-            'ipc.config.networkPort'.variable,
-            ipc.config.networkPort
-        );
-        port=ipc.config.networkPort;
-    }
- 
-    Iif(typeof UDPType=='function'){
-        callback=UDPType;
-        UDPType=false;
-    }
- 
-    Iif(!callback){
-        callback=emptyCallback;
-    }
- 
-    ipc.server=new Server(
-        host,
-        ipc.config,
-        log,
-        port
-    );
- 
-    if(UDPType){
-        ipc.server[UDPType]=true;
-    }
- 
-    ipc.server.on(
-        'start',
-        callback
-    );
-}
- 
-function connect(id,path,callback){
-    if(typeof path == 'function'){
-        callback=path;
-        path=false;
-    }
- 
-    Iif(!callback){
-        callback=emptyCallback;
-    }
- 
-    Iif(!id){
-        ipc.log(
-            'Service id required'.warn,
-            'Requested service connection without specifying service id. Aborting connection attempt'.notice
-        );
-        return;
-    }
- 
-    if(!path){
-        ipc.log(
-            'Service path not specified, so defaulting to'.notice,
-            'ipc.config.socketRoot + ipc.config.appspace + id'.variable,
-            (ipc.config.socketRoot+ipc.config.appspace+id).data
-        );
-        path=ipc.config.socketRoot+ipc.config.appspace+id;
-    }
- 
-    Iif(ipc.of[id]){
-        if(!ipc.of[id].socket.destroyed){
-            ipc.log(
-                'Already Connected to'.notice,
-                id.variable,
-                '- So executing success without connection'.notice
-            );
-            callback();
-            return;
-        }
-        ipc.of[id].socket.destroy();
-    }
- 
-    ipc.of[id] = new Client(ipc.config,ipc.log);
-    ipc.of[id].id = id;
-    ipc.of[id].path = path;
- 
-    ipc.of[id].connect();
- 
-    callback(ipc);
-}
- 
-function connectNet(id,host,port,callback){
-    Iif(!id){
-        ipc.log(
-            'Service id required'.warn,
-            'Requested service connection without specifying service id. Aborting connection attempt'.notice
-        );
-        return;
-    }
-    Eif(typeof host=='number'){
-        callback=port;
-        port=host;
-        host=false;
-    }
-    Iif(typeof host=='function'){
-        callback=host;
-        host=false;
-        port=false;
-    }
-    Eif(!host){
-        ipc.log(
-            'Server host not specified, so defaulting to'.notice,
-            'ipc.config.networkHost'.variable,
-            ipc.config.networkHost.data
-        );
-        host=ipc.config.networkHost;
-    }
- 
-    Iif(typeof port=='function'){
-        callback=port;
-        port=false;
-    }
-    Iif(!port){
-        ipc.log(
-            'Server port not specified, so defaulting to'.notice,
-            'ipc.config.networkPort'.variable,
-            ipc.config.networkPort
-        );
-        port=ipc.config.networkPort;
-    }
- 
-    Iif(typeof callback == 'string'){
-        UDPType=callback;
-        callback=false;
-    }
-    Iif(!callback){
-        callback=emptyCallback;
-    }
- 
-    Iif(ipc.of[id]){
-        if(!ipc.of[id].socket.destroyed){
-            ipc.log(
-                'Already Connected to'.notice,
-                id.variable,
-                '- So executing success without connection'.notice
-            );
-            callback();
-            return;
-        }
-        ipc.of[id].socket.destroy();
-    }
- 
-    ipc.of[id] = new Client(ipc.config,ipc.log);
-    ipc.of[id].id = id;
-    ipc.of[id].path = host;
-    ipc.of[id].port = port;
- 
-    ipc.of[id].connect();
- 
-    callback(ipc);
-}
- 
-module.exports=ipc;
+module.exports=new IPCModule;
  
diff --git a/spec/coverage/lcov-report/node-ipc/services/IPC.js.html b/spec/coverage/lcov-report/node-ipc/services/IPC.js.html new file mode 100644 index 0000000..dcd4d26 --- /dev/null +++ b/spec/coverage/lcov-report/node-ipc/services/IPC.js.html @@ -0,0 +1,1049 @@ + + + + Code coverage report for node-ipc/services/IPC.js + + + + + + + +
+
+

+ all files / node-ipc/services/ IPC.js +

+
+
+ 66.17% + Statements + 88/133 +
+
+ 60% + Branches + 42/70 +
+
+ 87.5% + Functions + 7/8 +
+
+ 66.17% + Lines + 88/133 +
+
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 +328 +329  +  + +  +  +  +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  + +114× +  +  +  +114× +  +114× +346× +318× +  +  +28× +  +  +114× +  +  +  +  + + +  +  +  + +  + + + + +  +  +  + +  +  + + +  +  +  + +  +  +  +  +  +  +  +  + +  +  +  + +  +  +  +  +  + +  +  +  +  +  + +  +  +  + + + + + + +  + + + + + +  + + +  +  +  +  + +  + +  +  +  +  +  +  + +  +  +  +  + +  +  +  +  + + +  +  +  +  + +  +  + +  +  +  +  + +  +  +  + +  +  +  +  +  +  + + +  +  + +  +  +  +  +  + + + + +  +  + +  +  +  + +  +  +  +  +  +  +  + + +  +  +  +  + +  +  + +  +  +  +  +  +  +  +  +  +  +  +  + + + +  + +  + +  +  + + +  +  +  +  +  +  + + + + +  + +  +  +  +  + + +  +  +  +  + +  +  + +  +  +  + +  +  +  +  +  +  +  +  + +  +  +  + +  +  +  + +  +  +  +  +  +  +  +  +  +  +  +  + + + + +  + +  + +  +  + + 
'use strict';
+ 
+const Defaults = require('../entities/Defaults.js'),
+    Client = require('../dao/client.js'),
+    Server = require('../dao/socketServer.js'),
+    util = require('util');
+ 
+class IPC{
+    constructor(){
+        Object.defineProperties(
+            this,
+            {
+                config      : {
+                    enumerable:true,
+                    writable:true,
+                    value:new Defaults
+                },
+                connectTo   : {
+                    enumerable:true,
+                    writable:false,
+                    value:connect
+                },
+                connectToNet: {
+                    enumerable:true,
+                    writable:false,
+                    value:connectNet
+                },
+                disconnect  : {
+                    enumerable:true,
+                    writable:false,
+                    value:disconnect
+                },
+                serve       : {
+                    enumerable:true,
+                    writable:false,
+                    value:serve
+                },
+                serveNet    : {
+                    enumerable:true,
+                    writable:false,
+                    value:serveNet
+                },
+                of          : {
+                    enumerable:true,
+                    writable:true,
+                    value:{}
+                },
+                server      : {
+                    enumerable:true,
+                    writable:true,
+                    configurable:true,
+                    value:false
+                },
+                log         : {
+                    enumerable:true,
+                    writable:false,
+                    value:log
+                }
+            }
+        );
+    }
+}
+ 
+function log(){
+    Iif(this.config.silent){
+        return;
+    }
+ 
+    let args=Array.prototype.slice.call(arguments);
+ 
+    for(let i=0, count=args.length; i<count; i++){
+        if(typeof args[i] != 'object'){
+            continue;
+        }
+ 
+        args[i]=util.inspect(args[i],{colors:true});
+    }
+ 
+    console.log(
+        args.join(' ')
+    );
+}
+ 
+function disconnect(id){
+    Iif(!this.of[id]){
+        return;
+    }
+ 
+    this.of[id].config.stopRetrying=true;
+ 
+    this.of[id].off('*');
+    Eif(this.of[id].socket){
+        Eif(this.of[id].socket.destroy){
+            this.of[id].socket.destroy();
+        }
+    }
+ 
+    delete this.of[id];
+}
+ 
+function serve(path,callback){
+    Iif(typeof path=='function'){
+        callback=path;
+        path=false;
+    }
+    Iif(!path){
+        this.log(
+            'Server path not specified, so defaulting to'.notice,
+            'ipc.config.socketRoot + ipc.config.appspace + ipc.config.id'.variable,
+            (this.config.socketRoot+this.config.appspace+this.config.id).data
+        );
+        path=this.config.socketRoot+this.config.appspace+this.config.id;
+    }
+ 
+    Iif(!callback){
+        callback=emptyCallback;
+    }
+ 
+    this.server=new Server(
+        path,
+        this.config,
+        log
+    );
+ 
+    this.server.on(
+        'start',
+        callback
+    );
+}
+ 
+function emptyCallback(){
+    //Do Nothing
+}
+ 
+function serveNet(host,port,UDPType,callback){
+    if(typeof host=='number'){
+        callback=UDPType;
+        UDPType=port;
+        port=host;
+        host=false;
+    }
+    if(typeof host=='function'){
+        callback=host;
+        UDPType=false;
+        host=false;
+        port=false;
+    }
+    if(!host){
+        this.log(
+            'Server host not specified, so defaulting to'.notice,
+            'ipc.config.networkHost'.variable,
+            this.config.networkHost.data
+        );
+        host=this.config.networkHost;
+    }
+    Iif(host.toLowerCase()=='udp4' || host.toLowerCase()=='udp6'){
+        callback=port;
+        UDPType=host.toLowerCase();
+        port=false;
+        host=this.config.networkHost;
+    }
+ 
+    Iif(typeof port=='string'){
+        callback=UDPType;
+        UDPType=port;
+        port=false;
+    }
+    Iif(typeof port=='function'){
+        callback=port;
+        UDPType=false;
+        port=false;
+    }
+    if(!port){
+        this.log(
+            'Server port not specified, so defaulting to'.notice,
+            'ipc.config.networkPort'.variable,
+            this.config.networkPort
+        );
+        port=this.config.networkPort;
+    }
+ 
+    Iif(typeof UDPType=='function'){
+        callback=UDPType;
+        UDPType=false;
+    }
+ 
+    Iif(!callback){
+        callback=emptyCallback;
+    }
+ 
+    this.server=new Server(
+        host,
+        this.config,
+        log,
+        port
+    );
+ 
+    if(UDPType){
+        this.server[UDPType]=true;
+    }
+ 
+    this.server.on(
+        'start',
+        callback
+    );
+}
+ 
+function connect(id,path,callback){
+    if(typeof path == 'function'){
+        callback=path;
+        path=false;
+    }
+ 
+    Iif(!callback){
+        callback=emptyCallback;
+    }
+ 
+    Iif(!id){
+        this.log(
+            'Service id required'.warn,
+            'Requested service connection without specifying service id. Aborting connection attempt'.notice
+        );
+        return;
+    }
+ 
+    if(!path){
+        this.log(
+            'Service path not specified, so defaulting to'.notice,
+            'ipc.config.socketRoot + ipc.config.appspace + id'.variable,
+            (this.config.socketRoot+this.config.appspace+id).data
+        );
+        path=this.config.socketRoot+this.config.appspace+id;
+    }
+ 
+    Iif(this.of[id]){
+        if(!this.of[id].socket.destroyed){
+            this.log(
+                'Already Connected to'.notice,
+                id.variable,
+                '- So executing success without connection'.notice
+            );
+            callback();
+            return;
+        }
+        this.of[id].socket.destroy();
+    }
+ 
+    this.of[id] = new Client(this.config,this.log);
+    this.of[id].id = id;
+    this.of[id].path = path;
+ 
+    this.of[id].connect();
+ 
+    callback(this);
+}
+ 
+function connectNet(id,host,port,callback){
+    Iif(!id){
+        this.log(
+            'Service id required'.warn,
+            'Requested service connection without specifying service id. Aborting connection attempt'.notice
+        );
+        return;
+    }
+    Eif(typeof host=='number'){
+        callback=port;
+        port=host;
+        host=false;
+    }
+    Iif(typeof host=='function'){
+        callback=host;
+        host=false;
+        port=false;
+    }
+    Eif(!host){
+        this.log(
+            'Server host not specified, so defaulting to'.notice,
+            'ipc.config.networkHost'.variable,
+            this.config.networkHost.data
+        );
+        host=this.config.networkHost;
+    }
+ 
+    Iif(typeof port=='function'){
+        callback=port;
+        port=false;
+    }
+    Iif(!port){
+        this.log(
+            'Server port not specified, so defaulting to'.notice,
+            'ipc.config.networkPort'.variable,
+            this.config.networkPort
+        );
+        port=this.config.networkPort;
+    }
+ 
+    Iif(typeof callback == 'string'){
+        UDPType=callback;
+        callback=false;
+    }
+    Iif(!callback){
+        callback=emptyCallback;
+    }
+ 
+    Iif(this.of[id]){
+        if(!this.of[id].socket.destroyed){
+            this.log(
+                'Already Connected to'.notice,
+                id.variable,
+                '- So executing success without connection'.notice
+            );
+            callback();
+            return;
+        }
+        this.of[id].socket.destroy();
+    }
+ 
+    this.of[id] = new Client(this.config,this.log);
+    this.of[id].id = id;
+    this.of[id].path = host;
+    this.of[id].port = port;
+ 
+    this.of[id].connect();
+ 
+    callback(this);
+}
+ 
+module.exports=IPC;
+ 
+
+
+ + + + + + + diff --git a/spec/coverage/lcov-report/node-ipc/services/index.html b/spec/coverage/lcov-report/node-ipc/services/index.html new file mode 100644 index 0000000..4ae53e3 --- /dev/null +++ b/spec/coverage/lcov-report/node-ipc/services/index.html @@ -0,0 +1,93 @@ + + + + Code coverage report for node-ipc/services/ + + + + + + + +
+
+

+ all files node-ipc/services/ +

+
+
+ 66.17% + Statements + 88/133 +
+
+ 60% + Branches + 42/70 +
+
+ 87.5% + Functions + 7/8 +
+
+ 66.17% + Lines + 88/133 +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
IPC.js
66.17%88/13360%42/7087.5%7/866.17%88/133
+
+
+ + + + + + + diff --git a/spec/coverage/lcov.info b/spec/coverage/lcov.info index d6f9e7a..61e89b1 100644 --- a/spec/coverage/lcov.info +++ b/spec/coverage/lcov.info @@ -1,14 +1,51 @@ TN: SF:/home/bmiller/git/node-ipc/node-ipc.js -FN:55,log -FN:75,disconnect -FN:92,serve -FN:122,emptyCallback -FN:126,serveNet -FN:199,connect -FN:248,connectNet -FNF:7 -FNH:6 +FN:8,(anonymous_1) +FNF:1 +FNH:1 +FNDA:1,(anonymous_1) +DA:3,1 +DA:9,1 +DA:10,1 +DA:23,1 +DA:25,1 +LF:5 +LH:5 +BRF:0 +BRH:0 +end_of_record +TN: +SF:/home/bmiller/git/node-ipc/entities/LogColors.js +FN:4,(anonymous_1) +FNF:1 +FNH:1 +FNDA:1,(anonymous_1) +DA:5,1 +DA:6,1 +DA:7,1 +DA:8,1 +DA:9,1 +DA:10,1 +DA:11,1 +DA:15,1 +LF:8 +LH:8 +BRF:0 +BRH:0 +end_of_record +TN: +SF:/home/bmiller/git/node-ipc/services/IPC.js +FN:9,(anonymous_1) +FN:64,log +FN:84,disconnect +FN:101,serve +FN:131,emptyCallback +FN:135,serveNet +FN:208,connect +FN:257,connectNet +FNF:8 +FNH:7 +FNDA:1,(anonymous_1) FNDA:114,log FNDA:7,disconnect FNDA:1,serve @@ -17,220 +54,232 @@ FNDA:3,serveNet FNDA:4,connect FNDA:3,connectNet DA:3,1 -DA:9,1 -DA:21,1 -DA:25,1 -DA:43,1 -DA:55,1 -DA:56,114 -DA:57,0 -DA:60,114 -DA:62,114 -DA:63,346 -DA:64,318 -DA:67,28 -DA:70,114 -DA:75,1 -DA:76,7 -DA:77,0 -DA:80,7 -DA:82,7 -DA:83,7 -DA:84,7 +DA:10,1 +DA:64,1 +DA:65,114 +DA:66,0 +DA:69,114 +DA:71,114 +DA:72,346 +DA:73,318 +DA:76,28 +DA:79,114 +DA:84,1 DA:85,7 +DA:86,0 DA:89,7 -DA:92,1 -DA:93,1 -DA:94,0 -DA:95,0 -DA:97,1 -DA:98,0 +DA:91,7 +DA:92,7 +DA:93,7 +DA:94,7 +DA:98,7 +DA:101,1 +DA:102,1 DA:103,0 +DA:104,0 DA:106,1 DA:107,0 -DA:110,1 -DA:116,1 -DA:122,1 -DA:126,1 -DA:127,3 -DA:128,1 -DA:129,1 -DA:130,1 +DA:112,0 +DA:115,1 +DA:116,0 +DA:119,1 +DA:125,1 DA:131,1 -DA:133,3 -DA:134,1 DA:135,1 -DA:136,1 +DA:136,3 DA:137,1 -DA:139,3 -DA:140,2 -DA:145,2 -DA:147,3 -DA:148,0 -DA:149,0 -DA:150,0 -DA:151,0 -DA:154,3 -DA:155,0 -DA:156,0 +DA:138,1 +DA:139,1 +DA:140,1 +DA:142,3 +DA:143,1 +DA:144,1 +DA:145,1 +DA:146,1 +DA:148,3 +DA:149,2 +DA:154,2 +DA:156,3 DA:157,0 -DA:159,3 +DA:158,0 +DA:159,0 DA:160,0 -DA:161,0 -DA:162,0 -DA:164,3 -DA:165,1 -DA:170,1 +DA:163,3 +DA:164,0 +DA:165,0 +DA:166,0 +DA:168,3 +DA:169,0 +DA:170,0 +DA:171,0 DA:173,3 -DA:174,0 -DA:175,0 -DA:178,3 -DA:179,0 +DA:174,1 +DA:179,1 DA:182,3 -DA:189,3 -DA:190,2 -DA:193,3 -DA:199,1 -DA:200,4 -DA:201,2 -DA:202,2 -DA:205,4 -DA:206,0 +DA:183,0 +DA:184,0 +DA:187,3 +DA:188,0 +DA:191,3 +DA:198,3 +DA:199,2 +DA:202,3 +DA:208,1 DA:209,4 -DA:210,0 -DA:214,0 -DA:217,4 -DA:218,2 -DA:223,2 +DA:210,2 +DA:211,2 +DA:214,4 +DA:215,0 +DA:218,4 +DA:219,0 +DA:223,0 DA:226,4 -DA:227,0 -DA:228,0 -DA:233,0 -DA:234,0 +DA:227,2 +DA:232,2 +DA:235,4 DA:236,0 -DA:239,4 -DA:240,4 -DA:241,4 -DA:243,4 -DA:245,4 -DA:248,1 -DA:249,3 -DA:250,0 -DA:254,0 -DA:256,3 -DA:257,3 +DA:237,0 +DA:242,0 +DA:243,0 +DA:245,0 +DA:248,4 +DA:249,4 +DA:250,4 +DA:252,4 +DA:254,4 +DA:257,1 DA:258,3 -DA:259,3 -DA:261,3 -DA:262,0 +DA:259,0 DA:263,0 -DA:264,0 +DA:265,3 DA:266,3 DA:267,3 -DA:272,3 +DA:268,3 +DA:270,3 +DA:271,0 +DA:272,0 +DA:273,0 DA:275,3 -DA:276,0 -DA:277,0 -DA:279,3 -DA:280,0 +DA:276,3 +DA:281,3 +DA:284,3 DA:285,0 +DA:286,0 DA:288,3 DA:289,0 -DA:290,0 -DA:292,3 -DA:293,0 -DA:296,3 -DA:297,0 +DA:294,0 +DA:297,3 DA:298,0 -DA:303,0 -DA:304,0 +DA:299,0 +DA:301,3 +DA:302,0 +DA:305,3 DA:306,0 -DA:309,3 -DA:310,3 -DA:311,3 -DA:312,3 -DA:314,3 -DA:316,3 -DA:319,1 -LF:136 -LH:91 -BRDA:28,1,0,0 -BRDA:28,1,1,1 -BRDA:56,2,0,0 -BRDA:56,2,1,114 -BRDA:63,3,0,318 -BRDA:63,3,1,28 -BRDA:76,4,0,0 -BRDA:76,4,1,7 -BRDA:83,5,0,7 -BRDA:83,5,1,0 -BRDA:84,6,0,7 -BRDA:84,6,1,0 -BRDA:93,7,0,0 -BRDA:93,7,1,1 -BRDA:97,8,0,0 -BRDA:97,8,1,1 -BRDA:106,9,0,0 -BRDA:106,9,1,1 -BRDA:127,10,0,1 -BRDA:127,10,1,2 -BRDA:133,11,0,1 -BRDA:133,11,1,2 -BRDA:139,12,0,2 -BRDA:139,12,1,1 -BRDA:147,13,0,0 -BRDA:147,13,1,3 -BRDA:147,14,0,3 -BRDA:147,14,1,3 -BRDA:154,15,0,0 -BRDA:154,15,1,3 -BRDA:159,16,0,0 -BRDA:159,16,1,3 -BRDA:164,17,0,1 -BRDA:164,17,1,2 -BRDA:173,18,0,0 -BRDA:173,18,1,3 -BRDA:178,19,0,0 -BRDA:178,19,1,3 -BRDA:189,20,0,2 -BRDA:189,20,1,1 -BRDA:200,21,0,2 -BRDA:200,21,1,2 -BRDA:205,22,0,0 -BRDA:205,22,1,4 -BRDA:209,23,0,0 -BRDA:209,23,1,4 -BRDA:217,24,0,2 -BRDA:217,24,1,2 -BRDA:226,25,0,0 -BRDA:226,25,1,4 -BRDA:227,26,0,0 -BRDA:227,26,1,0 -BRDA:249,27,0,0 -BRDA:249,27,1,3 -BRDA:256,28,0,3 -BRDA:256,28,1,0 -BRDA:261,29,0,0 -BRDA:261,29,1,3 -BRDA:266,30,0,3 -BRDA:266,30,1,0 -BRDA:275,31,0,0 -BRDA:275,31,1,3 -BRDA:279,32,0,0 -BRDA:279,32,1,3 -BRDA:288,33,0,0 -BRDA:288,33,1,3 -BRDA:292,34,0,0 -BRDA:292,34,1,3 -BRDA:296,35,0,0 -BRDA:296,35,1,3 -BRDA:297,36,0,0 -BRDA:297,36,1,0 -BRF:72 -BRH:43 +DA:307,0 +DA:312,0 +DA:313,0 +DA:315,0 +DA:318,3 +DA:319,3 +DA:320,3 +DA:321,3 +DA:323,3 +DA:325,3 +DA:328,1 +LF:133 +LH:88 +BRDA:65,1,0,0 +BRDA:65,1,1,114 +BRDA:72,2,0,318 +BRDA:72,2,1,28 +BRDA:85,3,0,0 +BRDA:85,3,1,7 +BRDA:92,4,0,7 +BRDA:92,4,1,0 +BRDA:93,5,0,7 +BRDA:93,5,1,0 +BRDA:102,6,0,0 +BRDA:102,6,1,1 +BRDA:106,7,0,0 +BRDA:106,7,1,1 +BRDA:115,8,0,0 +BRDA:115,8,1,1 +BRDA:136,9,0,1 +BRDA:136,9,1,2 +BRDA:142,10,0,1 +BRDA:142,10,1,2 +BRDA:148,11,0,2 +BRDA:148,11,1,1 +BRDA:156,12,0,0 +BRDA:156,12,1,3 +BRDA:156,13,0,3 +BRDA:156,13,1,3 +BRDA:163,14,0,0 +BRDA:163,14,1,3 +BRDA:168,15,0,0 +BRDA:168,15,1,3 +BRDA:173,16,0,1 +BRDA:173,16,1,2 +BRDA:182,17,0,0 +BRDA:182,17,1,3 +BRDA:187,18,0,0 +BRDA:187,18,1,3 +BRDA:198,19,0,2 +BRDA:198,19,1,1 +BRDA:209,20,0,2 +BRDA:209,20,1,2 +BRDA:214,21,0,0 +BRDA:214,21,1,4 +BRDA:218,22,0,0 +BRDA:218,22,1,4 +BRDA:226,23,0,2 +BRDA:226,23,1,2 +BRDA:235,24,0,0 +BRDA:235,24,1,4 +BRDA:236,25,0,0 +BRDA:236,25,1,0 +BRDA:258,26,0,0 +BRDA:258,26,1,3 +BRDA:265,27,0,3 +BRDA:265,27,1,0 +BRDA:270,28,0,0 +BRDA:270,28,1,3 +BRDA:275,29,0,3 +BRDA:275,29,1,0 +BRDA:284,30,0,0 +BRDA:284,30,1,3 +BRDA:288,31,0,0 +BRDA:288,31,1,3 +BRDA:297,32,0,0 +BRDA:297,32,1,3 +BRDA:301,33,0,0 +BRDA:301,33,1,3 +BRDA:305,34,0,0 +BRDA:305,34,1,3 +BRDA:306,35,0,0 +BRDA:306,35,1,0 +BRF:70 +BRH:42 end_of_record TN: -SF:/home/bmiller/git/node-ipc/lib/client.js +SF:/home/bmiller/git/node-ipc/entities/Defaults.js +FN:5,(anonymous_1) +FNF:1 +FNH:1 +FNDA:1,(anonymous_1) +DA:2,1 +DA:6,1 +DA:10,1 +DA:93,1 +LF:4 +LH:4 +BRDA:26,1,0,0 +BRDA:26,1,1,1 +BRF:2 +BRH:1 +end_of_record +TN: +SF:/home/bmiller/git/node-ipc/dao/client.js FN:11,init FN:27,emit FN:50,syncEmit @@ -404,7 +453,7 @@ BRF:42 BRH:22 end_of_record TN: -SF:/home/bmiller/git/node-ipc/lib/eventParser.js +SF:/home/bmiller/git/node-ipc/dao/eventParser.js FN:9,formatData FN:21,parseDataEvents FNF:2 @@ -434,7 +483,7 @@ BRF:4 BRH:2 end_of_record TN: -SF:/home/bmiller/git/node-ipc/lib/socketServer.js +SF:/home/bmiller/git/node-ipc/dao/socketServer.js FN:11,emit FN:42,broadcast FN:65,init