mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-24 06:05:53 -05:00
Server optimizations.
This commit is contained in:
parent
cee5f2ac00
commit
c513b39fb7
File diff suppressed because it is too large
Load Diff
556
meshagent.js
556
meshagent.js
File diff suppressed because it is too large
Load Diff
@ -1377,7 +1377,7 @@ function CreateMeshCentralServer(config, args) {
|
||||
obj.meshAgentBinaries[archid].path = agentpath;
|
||||
obj.meshAgentBinaries[archid].url = ((obj.args.notls == true) ? 'http://' : 'https://') + obj.certificates.CommonName + ':' + obj.args.port + '/meshagents?id=' + archid;
|
||||
obj.meshAgentBinaries[archid].size = stats.size;
|
||||
if (!obj.args.agentsondisk) { obj.meshAgentBinaries[archid].data = obj.fs.readFileSync(agentpath); }
|
||||
if (obj.args.agentsinram) { obj.meshAgentBinaries[archid].data = obj.fs.readFileSync(agentpath); }
|
||||
// If this is a windows binary, pull binary information
|
||||
if (obj.meshAgentsArchitectureNumbers[archid].platform == 'win32') {
|
||||
try { obj.meshAgentBinaries[archid].pe = obj.exeHandler.parseWindowsExecutable(agentpath); } catch (e) { }
|
||||
@ -1387,7 +1387,7 @@ function CreateMeshCentralServer(config, args) {
|
||||
var hashStream = obj.crypto.createHash('sha384');
|
||||
hashStream.archid = archid;
|
||||
hashStream.on('data', function (data) {
|
||||
obj.meshAgentBinaries[this.archid].hash = data.toString('hex');
|
||||
obj.meshAgentBinaries[this.archid].hash = data.toString('binary');
|
||||
if ((--archcount == 0) && (func != null)) { func(); }
|
||||
});
|
||||
var options = { sourcePath: agentpath, targetStream: hashStream, platform: obj.meshAgentsArchitectureNumbers[archid].platform };
|
||||
|
@ -471,7 +471,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||
switch (cmd) {
|
||||
case 'help': {
|
||||
r = 'Available commands: help, info, versions, args, resetserver, showconfig, usersessions, tasklimiter, setmaxtasks, cores,\r\n'
|
||||
r += 'migrationagents, swarmstats, nodeconfig.';
|
||||
r += 'migrationagents, swarmstats, nodeconfig, heapdump.';
|
||||
break;
|
||||
}
|
||||
case 'info': {
|
||||
@ -562,7 +562,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
|
||||
} else {
|
||||
for (var i in obj.parent.parent.swarmserver.migrationAgents) {
|
||||
var arch = obj.parent.parent.swarmserver.migrationAgents[i];
|
||||
for (var j in arch) { var agent = arch[j]; r += 'Arch ' + agent.arch + ', Ver ' + agent.ver + ', Size ' + agent.binary.length + '<br />'; }
|
||||
for (var j in arch) { var agent = arch[j]; r += 'Arch ' + agent.arch + ', Ver ' + agent.ver + ', Size ' + ((agent.binary == null) ? 0 : agent.binary.length) + '<br />'; }
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "meshcentral",
|
||||
"version": "0.2.9-r",
|
||||
"version": "0.2.9-w",
|
||||
"keywords": [
|
||||
"Remote Management",
|
||||
"Intel AMT",
|
||||
@ -35,15 +35,12 @@
|
||||
"express": "^4.16.4",
|
||||
"express-handlebars": "^3.0.0",
|
||||
"express-ws": "^4.0.0",
|
||||
"heapdump": "^0.3.12",
|
||||
"ipcheck": "^0.1.0",
|
||||
"meshcentral": "*",
|
||||
"minimist": "^1.2.0",
|
||||
"mongojs": "^2.6.0",
|
||||
"multiparty": "^4.2.1",
|
||||
"nedb": "^1.8.0",
|
||||
"node-forge": "^0.7.6",
|
||||
"node-windows": "^0.1.14",
|
||||
"otplib": "^10.0.1",
|
||||
"util.promisify": "^1.0.0",
|
||||
"ws": "^6.1.2",
|
||||
|
@ -138,9 +138,8 @@ module.exports.CreateSwarmServer = function (parent, db, args, certificates) {
|
||||
var agentInfo = migrationAgentsDir[i].substring(10).split('.');
|
||||
var agentVersion = parseInt(agentInfo[0]);
|
||||
var agentArch = parseInt(agentInfo[1]);
|
||||
var agentBinary = obj.parent.fs.readFileSync(migrationAgentName);
|
||||
if (obj.migrationAgents[agentArch] == null) { obj.migrationAgents[agentArch] = {}; }
|
||||
if (obj.migrationAgents[agentArch][agentVersion] == null) { obj.migrationAgents[agentArch][agentVersion] = { arch: agentArch, ver: agentVersion, path: migrationAgentName, binary: agentBinary }; }
|
||||
if (obj.migrationAgents[agentArch][agentVersion] == null) { obj.migrationAgents[agentArch][agentVersion] = { arch: agentArch, ver: agentVersion, path: migrationAgentName }; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -270,6 +269,7 @@ module.exports.CreateSwarmServer = function (parent, db, args, certificates) {
|
||||
case 6: { // Ask for agent block
|
||||
if (socket.tag.update != null) {
|
||||
// Send an agent block
|
||||
if (socket.tag.update.binary == null) { socket.tag.update.binary = obj.parent.fs.readFileSync(socket.tag.update.path); }
|
||||
var l = Math.min(socket.tag.update.binary.length - socket.tag.updatePtr, 16384);
|
||||
obj.SendCommand(socket, LegacyMeshProtocol.GETSTATE, common.IntToStr(6) + common.IntToStr(socket.tag.updatePtr) + socket.tag.update.binary.toString('binary', socket.tag.updatePtr, socket.tag.updatePtr + l)); // agent.SendQuery(6, AgentFileLen + AgentBlock);
|
||||
Debug(3, 'Swarm:Sending agent block, ptr = ' + socket.tag.updatePtr + ', len = ' + l);
|
||||
|
Loading…
Reference in New Issue
Block a user