mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-11-08 21:24:53 -05:00
Updated metadata and modified amt-lme to hook newListener for 'connect' because JS HECI is much faster than old implementation
This commit is contained in:
@@ -117,6 +117,7 @@ function lme_heci(options) {
|
||||
emitterUtils.createEvent('notify');
|
||||
emitterUtils.createEvent('bind');
|
||||
|
||||
this.on('newListener', function (name, func) { if (name == 'connect' && this._LME._connected == true) { func.call(this);} });
|
||||
if ((options != null) && (options.debug == true)) { lme_port_offset = -100; } // LMS debug mode
|
||||
|
||||
var heci = require('heci');
|
||||
@@ -124,10 +125,14 @@ function lme_heci(options) {
|
||||
|
||||
this._ObjectID = "lme";
|
||||
this._LME = heci.create();
|
||||
this._LME._connected = false;
|
||||
this._LME.descriptorMetadata = "amt-lme";
|
||||
this._LME._binded = {};
|
||||
this._LME.LMS = this;
|
||||
this._LME.on('error', function (e) { this.LMS.emit('error', e); });
|
||||
this._LME.on('connect', function () {
|
||||
this._LME.on('connect', function ()
|
||||
{
|
||||
this._connected = true;
|
||||
this.on('data', function (chunk) {
|
||||
// this = HECI
|
||||
var cmd = chunk.readUInt8(0);
|
||||
@@ -173,6 +178,7 @@ function lme_heci(options) {
|
||||
try {
|
||||
// Bind a new server socket if not already present
|
||||
this[name][port] = require('net').createServer();
|
||||
this[name][port].descriptorMetadata = 'amt-lme (port: ' + port + ')';
|
||||
this[name][port].HECI = this;
|
||||
if (lme_port_offset == 0) {
|
||||
this[name][port].listen({ port: port, host: '127.0.0.1' }); // Normal mode
|
||||
|
||||
Reference in New Issue
Block a user