1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2026-01-03 17:13:16 +00:00

Synced with server repo

This commit is contained in:
Bryan Roe
2020-04-06 17:22:26 -07:00
parent 3cd06ea4aa
commit d1fcb0cd61
16 changed files with 114 additions and 98 deletions

View File

@@ -1,5 +1,5 @@
/*
Copyright 2018 Intel Corporation
Copyright 2018-2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -169,23 +169,23 @@ function lme_heci(options) {
}
}
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;
{
try {
// 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) {
this[name][port].listen({ port: port, host: '127.0.0.1' }); // Normal mode
} else {
this[name][port].listen({ port: (port + lme_port_offset) }); // Debug mode
}
} catch (ex) { console.log('Binding error, LMS port ' + (port + lme_port_offset) + ': ' + ex) } // TODO: We can't bind
this[name][port].on('connection', function (socket) {
//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);
this[name][port].on('connection', function (socket) {
//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);
} catch (ex) { console.log(ex, 'Port ' + port); }
}
var outBuffer = Buffer.alloc(5);
outBuffer.writeUInt8(81, 0);