1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-15 07:43:50 +00:00

Updated concurrency support for Windows

This commit is contained in:
Bryan Roe
2020-10-08 16:31:55 -07:00
parent 3f6f00f915
commit 1ef348bbc4
3 changed files with 109 additions and 87 deletions

View File

@@ -34,13 +34,11 @@ function queryAgent(obj, prev)
{
var ret = new promise(function (res, rej) { this._res = res; this._rej = rej; });
ret._obj = { cmd: 'query', value: obj };
console.log(obj, prev);
if (prev == null)
{
ret.client = require('net').createConnection({ path: ipcPath });
ret.client.on('connect', function ()
{
console.log('ON CONNECT');
this.on('data', dataHandler);
this.on('end', function ()
{
@@ -89,7 +87,7 @@ function start()
if (res == null) { res = '[NOT CONNECTED]'; }
console.log('Mesh Agent connected to: ' + res);
return (queryAgent('descriptors', connection));
}).then(console.log).then(function () { process._exit(); }).catch(function () { process._exit(); });
}).then(function (v) { console.log(v); }).then(function () { process._exit(); }).catch(function () { process._exit(); });
}
module.exports = { start: start };