1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Improved My Files tab, new version of MeshCmd

This commit is contained in:
Ylian Saint-Hilaire 2018-04-03 17:07:48 -07:00
parent 63a165aac0
commit 8287997b2d
19 changed files with 1112 additions and 88 deletions

View file

@ -52,7 +52,7 @@ function stream_bufferedWrite() {
var emitterUtils = require('events').inherits(this);
this.buffer = [];
this._readCheckImmediate = undefined;
this._ObjectID = "bufferedWriteStream";
// Writable Events
emitterUtils.createEvent('close');
emitterUtils.createEvent('drain');
@ -115,17 +115,19 @@ function lme_heci(options) {
emitterUtils.createEvent('error');
emitterUtils.createEvent('connect');
emitterUtils.createEvent('notify');
emitterUtils.createEvent('bind');
if ((options != null) && (options.debug == true)) { lme_port_offset = -100; } // LMS debug mode
var heci = require('heci');
this.INITIAL_RXWINDOW_SIZE = 4096;
this._ObjectID = "lme";
this._LME = heci.create();
this._LME._binded = {};
this._LME.LMS = this;
this._LME.on('error', function (e) { this.LMS.emit('error', e); });
this._LME.on('connect', function () {
this.LMS.emit('connect');
this.on('data', function (chunk) {
// this = HECI
var cmd = chunk.readUInt8(0);
@ -166,7 +168,8 @@ function lme_heci(options) {
if (channel.localPort == port) { this.sockets[i].end(); delete this.sockets[i]; } // Close this socket
}
}
if (this[name][port] == null) { // Bind a new server socket if not already present
if (this[name][port] == null)
{ // Bind a new server socket if not already present
this[name][port] = require('net').createServer();
this[name][port].HECI = this;
if (lme_port_offset == 0) {
@ -178,6 +181,8 @@ function lme_heci(options) {
//console.log('New [' + socket.remoteFamily + '] TCP Connection on: ' + socket.remoteAddress + ' :' + socket.localPort);
this.HECI.LMS.bindDuplexStream(socket, socket.remoteFamily, socket.localPort - lme_port_offset);
});
this._binded[port] = true;
this.LMS.emit('bind', this._binded);
}
var outBuffer = Buffer.alloc(5);
outBuffer.writeUInt8(81, 0);
@ -388,6 +393,9 @@ function lme_heci(options) {
break;
}
});
this.LMS.emit('connect');
this.resume();
});
this.bindDuplexStream = function (duplexStream, remoteFamily, localPort) {