mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-06 00:13:33 +00:00
Fixed race
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,11 +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);
|
||||
|
||||
Reference in New Issue
Block a user