fixed some formatting
This commit is contained in:
parent
143e23ca4d
commit
9f1755374a
3 changed files with 17 additions and 11 deletions
|
@ -70,7 +70,7 @@ function connect(){
|
||||||
if (process.platform ==='win32' && !client.path.startsWith('\\\\.\\pipe\\')){
|
if (process.platform ==='win32' && !client.path.startsWith('\\\\.\\pipe\\')){
|
||||||
path = path.replace(/^\//, '');
|
path = path.replace(/^\//, '');
|
||||||
path = path.replace(/\//g, '-');
|
path = path.replace(/\//g, '-');
|
||||||
path= '\\\\.\\pipe\\'+path;
|
path= `\\\\.\\pipe\\${path}`;
|
||||||
}
|
}
|
||||||
client.socket = net.connect(
|
client.socket = net.connect(
|
||||||
{
|
{
|
||||||
|
@ -138,7 +138,9 @@ function connect(){
|
||||||
client.socket.on(
|
client.socket.on(
|
||||||
'close',
|
'close',
|
||||||
function connectionClosed(){
|
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(
|
||||||
client.config.stopRetrying || client.retriesRemaining<1
|
client.config.stopRetrying || client.retriesRemaining<1
|
||||||
|
|
|
@ -4,7 +4,7 @@ const net = require('net'),
|
||||||
tls = require('tls'),
|
tls = require('tls'),
|
||||||
fs = require('fs'),
|
fs = require('fs'),
|
||||||
dgram = require('dgram'),
|
dgram = require('dgram'),
|
||||||
eventParser = require('./eventParser.js'),
|
eventParser = require('../lib/eventParser.js'),
|
||||||
Pubsub = require('event-pubsub'),
|
Pubsub = require('event-pubsub'),
|
||||||
Message = require('js-message');
|
Message = require('js-message');
|
||||||
|
|
||||||
|
@ -92,7 +92,10 @@ function init(path,config,log,port){
|
||||||
fs.unlink(
|
fs.unlink(
|
||||||
this.path,
|
this.path,
|
||||||
function () {
|
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){
|
||||||
if(!server.config.tls){
|
if(!server.config.tls){
|
||||||
|
@ -104,12 +107,12 @@ function init(path,config,log,port){
|
||||||
if(server.config.tls.private){
|
if(server.config.tls.private){
|
||||||
server.config.tls.key=fs.readFileSync(server.config.tls.private);
|
server.config.tls.key=fs.readFileSync(server.config.tls.private);
|
||||||
}else{
|
}else{
|
||||||
server.config.tls.key=fs.readFileSync(__dirname+'/../local-node-ipc-certs/private/server.key');
|
server.config.tls.key=fs.readFileSync(`${__dirname}/../local-node-ipc-certs/private/server.key`);
|
||||||
}
|
}
|
||||||
if(server.config.tls.public){
|
if(server.config.tls.public){
|
||||||
server.config.tls.cert=fs.readFileSync(server.config.tls.public);
|
server.config.tls.cert=fs.readFileSync(server.config.tls.public);
|
||||||
}else{
|
}else{
|
||||||
server.config.tls.cert=fs.readFileSync(__dirname+'/../local-node-ipc-certs/server.pub');
|
server.config.tls.cert=fs.readFileSync(`${__dirname}/../local-node-ipc-certs/server.pub`);
|
||||||
}
|
}
|
||||||
if(server.config.tls.dhparam){
|
if(server.config.tls.dhparam){
|
||||||
server.config.tls.dhparam=fs.readFileSync(server.config.tls.dhparam);
|
server.config.tls.dhparam=fs.readFileSync(server.config.tls.dhparam);
|
||||||
|
@ -289,10 +292,10 @@ function init(path,config,log,port){
|
||||||
if(!port){
|
if(!port){
|
||||||
server.log('starting server as'.debug, 'Unix || Windows Socket'.variable);
|
server.log('starting server as'.debug, 'Unix || Windows Socket'.variable);
|
||||||
if (process.platform ==='win32'){
|
if (process.platform ==='win32'){
|
||||||
server.path = server.path.replace(/^\//, '');
|
server.path = server.path.replace(/^\//, '');
|
||||||
server.path = server.path.replace(/\//g, '-');
|
server.path = server.path.replace(/\//g, '-');
|
||||||
server.path= '\\\\.\\pipe\\'+server.path;
|
server.path= `\\\\.\\pipe\\${server.path}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
server.server.listen(
|
server.server.listen(
|
||||||
server.path,
|
server.path,
|
||||||
|
@ -348,7 +351,7 @@ function init(path,config,log,port){
|
||||||
destroyedSocketId=socket.id;
|
destroyedSocketId=socket.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
server.log('socket disconnected'.notice,' '+destroyedSocketId.variable);
|
server.log('socket disconnected'.notice,destroyedSocketId.toString().variable);
|
||||||
|
|
||||||
if(socket && socket.destroy){
|
if(socket && socket.destroy){
|
||||||
socket.destroy();
|
socket.destroy();
|
||||||
|
|
|
@ -7,6 +7,7 @@ const colors = require('colors'),
|
||||||
class IPCModule extends IPC{
|
class IPCModule extends IPC{
|
||||||
constructor(){
|
constructor(){
|
||||||
super();
|
super();
|
||||||
|
//include IPC to make extensible
|
||||||
Object.defineProperty(
|
Object.defineProperty(
|
||||||
this,
|
this,
|
||||||
'IPC',
|
'IPC',
|
||||||
|
|
Loading…
Reference in a new issue