mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-24 22:25:52 -05:00
Server UI and scaling fixes.
This commit is contained in:
parent
a2a1f73a25
commit
e670055cf1
10
meshagent.js
10
meshagent.js
@ -50,9 +50,10 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
|||||||
|
|
||||||
// Disconnect this agent
|
// Disconnect this agent
|
||||||
obj.close = function (arg) {
|
obj.close = function (arg) {
|
||||||
|
obj.authenticated = -1;
|
||||||
if ((arg == 1) || (arg == null)) { try { obj.ws.close(); if (obj.nodeid != null) { obj.parent.parent.debug(1, 'Soft disconnect ' + obj.nodeid + ' (' + obj.remoteaddrport + ')'); } } catch (e) { console.log(e); } } // Soft close, close the websocket
|
if ((arg == 1) || (arg == null)) { try { obj.ws.close(); if (obj.nodeid != null) { obj.parent.parent.debug(1, 'Soft disconnect ' + obj.nodeid + ' (' + obj.remoteaddrport + ')'); } } catch (e) { console.log(e); } } // Soft close, close the websocket
|
||||||
if (arg == 2) { try { obj.ws._socket._parent.end(); if (obj.nodeid != null) { obj.parent.parent.debug(1, 'Hard disconnect ' + obj.nodeid + ' (' + obj.remoteaddrport + ')'); } } catch (e) { console.log(e); } } // Hard close, close the TCP socket
|
if (arg == 2) { try { obj.ws._socket._parent.end(); if (obj.nodeid != null) { obj.parent.parent.debug(1, 'Hard disconnect ' + obj.nodeid + ' (' + obj.remoteaddrport + ')'); } } catch (e) { console.log(e); } } // Hard close, close the TCP socket
|
||||||
if (arg == 3) { obj.authenticated = -1; } // Don't communicate with this agent anymore, but don't disconnect (Duplicate agent).
|
// If arg == 3, don't communicate with this agent anymore, but don't disconnect (Duplicate agent).
|
||||||
if (obj.parent.wsagents[obj.dbNodeKey] == obj) {
|
if (obj.parent.wsagents[obj.dbNodeKey] == obj) {
|
||||||
delete obj.parent.wsagents[obj.dbNodeKey];
|
delete obj.parent.wsagents[obj.dbNodeKey];
|
||||||
obj.parent.parent.ClearConnectivityState(obj.dbMeshKey, obj.dbNodeKey, 1);
|
obj.parent.parent.ClearConnectivityState(obj.dbMeshKey, obj.dbNodeKey, 1);
|
||||||
@ -152,10 +153,16 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
|||||||
// Update new core with task limiting so not to flood the server. This is a high priority task.
|
// Update new core with task limiting so not to flood the server. This is a high priority task.
|
||||||
obj.agentCoreUpdatePending = true;
|
obj.agentCoreUpdatePending = true;
|
||||||
obj.parent.parent.taskLimiter.launch(function (argument, taskid, taskLimiterQueue) {
|
obj.parent.parent.taskLimiter.launch(function (argument, taskid, taskLimiterQueue) {
|
||||||
|
if (obj.authenticated == 2) {
|
||||||
|
// Send the updated code.
|
||||||
obj.agentCoreUpdatePending = false;
|
obj.agentCoreUpdatePending = false;
|
||||||
obj.send(obj.common.ShortToStr(10) + obj.common.ShortToStr(0) + argument.hash + argument.core, function () { obj.parent.parent.taskLimiter.completed(taskid); }); // MeshCommand_CoreModule, start core update
|
obj.send(obj.common.ShortToStr(10) + obj.common.ShortToStr(0) + argument.hash + argument.core, function () { obj.parent.parent.taskLimiter.completed(taskid); }); // MeshCommand_CoreModule, start core update
|
||||||
obj.parent.parent.debug(1, 'Updating code ' + argument.name);
|
obj.parent.parent.debug(1, 'Updating code ' + argument.name);
|
||||||
agentCoreIsStable();
|
agentCoreIsStable();
|
||||||
|
} else {
|
||||||
|
// This agent is probably disconnected, nothing to do.
|
||||||
|
obj.parent.parent.taskLimiter.completed(taskid);
|
||||||
|
}
|
||||||
}, { hash: meshcorehash, core: obj.parent.parent.defaultMeshCores[corename], name: corename }, 0);
|
}, { hash: meshcorehash, core: obj.parent.parent.defaultMeshCores[corename], name: corename }, 0);
|
||||||
}
|
}
|
||||||
obj.agentCoreCheck++;
|
obj.agentCoreCheck++;
|
||||||
@ -197,6 +204,7 @@ module.exports.CreateMeshAgent = function (parent, db, ws, req, args, domain) {
|
|||||||
if ((agenthash != obj.agentExeInfo.hash) && (agenthash != '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000')) {
|
if ((agenthash != obj.agentExeInfo.hash) && (agenthash != '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000')) {
|
||||||
// Mesh agent update required, do it using task limiter so not to flood the network. Medium priority task.
|
// Mesh agent update required, do it using task limiter so not to flood the network. Medium priority task.
|
||||||
obj.parent.parent.taskLimiter.launch(function (argument, taskid, taskLimiterQueue) {
|
obj.parent.parent.taskLimiter.launch(function (argument, taskid, taskLimiterQueue) {
|
||||||
|
if (obj.authenticated != 2) { obj.parent.parent.taskLimiter.completed(taskid); return; } // If agent disconnection, complete and exit now.
|
||||||
if (obj.nodeid != null) { obj.parent.parent.debug(1, 'Agent update required, NodeID=0x' + obj.nodeid.substring(0, 16) + ', ' + obj.agentExeInfo.desc); }
|
if (obj.nodeid != null) { obj.parent.parent.debug(1, 'Agent update required, NodeID=0x' + obj.nodeid.substring(0, 16) + ', ' + obj.agentExeInfo.desc); }
|
||||||
if (obj.agentExeInfo.data == null) {
|
if (obj.agentExeInfo.data == null) {
|
||||||
// Read the agent from disk
|
// Read the agent from disk
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "meshcentral",
|
"name": "meshcentral",
|
||||||
"version": "0.2.9-b",
|
"version": "0.2.9-c",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Remote Management",
|
"Remote Management",
|
||||||
"Intel AMT",
|
"Intel AMT",
|
||||||
|
@ -217,8 +217,14 @@ module.exports.CreateSwarmServer = function (parent, db, args, certificates) {
|
|||||||
|
|
||||||
// Start the agent download using the task limiter so not to flood the server. Low priority task
|
// Start the agent download using the task limiter so not to flood the server. Low priority task
|
||||||
obj.parent.taskLimiter.launch(function (socket, taskid, taskLimiterQueue) {
|
obj.parent.taskLimiter.launch(function (socket, taskid, taskLimiterQueue) {
|
||||||
|
if (socket.xclosed == 1) {
|
||||||
|
// Socket is closed, do nothing
|
||||||
|
obj.parent.taskLimiter.completed(taskid); // Indicate this task complete
|
||||||
|
} else {
|
||||||
|
// Start the agent update
|
||||||
socket.tag.taskid = taskid;
|
socket.tag.taskid = taskid;
|
||||||
obj.SendCommand(socket, LegacyMeshProtocol.GETSTATE, common.IntToStr(5) + common.IntToStr(0)); // agent.SendQuery(5, 0); // Start the agent download
|
obj.SendCommand(socket, LegacyMeshProtocol.GETSTATE, common.IntToStr(5) + common.IntToStr(0)); // agent.SendQuery(5, 0); // Start the agent download
|
||||||
|
}
|
||||||
}, socket, 2);
|
}, socket, 2);
|
||||||
} else {
|
} else {
|
||||||
//console.log('No legacy agent update for ' + nodeblock.agentversion + '.' + nodeblock.agenttype + ' on ' + nodeblock.agentname + '.');
|
//console.log('No legacy agent update for ' + nodeblock.agentversion + '.' + nodeblock.agenttype + ' on ' + nodeblock.agentname + '.');
|
||||||
@ -353,6 +359,7 @@ module.exports.CreateSwarmServer = function (parent, db, args, certificates) {
|
|||||||
// Disconnect legacy agent connection
|
// Disconnect legacy agent connection
|
||||||
obj.close = function (socket) {
|
obj.close = function (socket) {
|
||||||
try { socket.close(); } catch (e) { }
|
try { socket.close(); } catch (e) { }
|
||||||
|
socket.xclosed = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
obj.SendCommand = function (socket, cmdid, data) {
|
obj.SendCommand = function (socket, cmdid, data) {
|
||||||
|
File diff suppressed because one or more lines are too long
@ -5256,6 +5256,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
function agentConsoleHandleKeys(e) {
|
function agentConsoleHandleKeys(e) {
|
||||||
|
if ((e.ctrlKey) || (e.altKey)) { return true; }
|
||||||
var processed = 0, box = Q('p15consoleText');
|
var processed = 0, box = Q('p15consoleText');
|
||||||
if (e.key) {
|
if (e.key) {
|
||||||
if (e.keyCode == 13 && consoleFocus == 0) { p15consoleSend(e); processed = 1; }
|
if (e.keyCode == 13 && consoleFocus == 0) { p15consoleSend(e); processed = 1; }
|
||||||
@ -5299,6 +5300,7 @@
|
|||||||
consoleNode = 'server';
|
consoleNode = 'server';
|
||||||
|
|
||||||
QH('p15deviceName', 'My Server Console');
|
QH('p15deviceName', 'My Server Console');
|
||||||
|
QE('p15consoleText', true);
|
||||||
QH('p15statetext', '');
|
QH('p15statetext', '');
|
||||||
QH('p15coreName', '');
|
QH('p15coreName', '');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user