mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-11-26 07:57:56 +03:00
Improved desktop multiplexor
This commit is contained in:
parent
4a98336c15
commit
ca6bf1b375
@ -93,6 +93,7 @@ function CreateDesktopMultiplexor(parent, domain, nodeid, func) {
|
|||||||
|
|
||||||
// Add an agent or viewer
|
// Add an agent or viewer
|
||||||
obj.addPeer = function (peer) {
|
obj.addPeer = function (peer) {
|
||||||
|
if (obj.viewers == null) return;
|
||||||
if (peer.req.query.browser) {
|
if (peer.req.query.browser) {
|
||||||
//console.log('addPeer-viewer', obj.nodeid);
|
//console.log('addPeer-viewer', obj.nodeid);
|
||||||
|
|
||||||
@ -166,6 +167,7 @@ function CreateDesktopMultiplexor(parent, domain, nodeid, func) {
|
|||||||
// Remove an agent or viewer
|
// Remove an agent or viewer
|
||||||
// Return true if this multiplexor is no longer needed.
|
// Return true if this multiplexor is no longer needed.
|
||||||
obj.removePeer = function (peer) {
|
obj.removePeer = function (peer) {
|
||||||
|
if (obj.viewers == null) return;
|
||||||
if (peer == obj.agent) {
|
if (peer == obj.agent) {
|
||||||
//console.log('removePeer-agent', obj.nodeid);
|
//console.log('removePeer-agent', obj.nodeid);
|
||||||
// Clean up the agent
|
// Clean up the agent
|
||||||
@ -263,7 +265,7 @@ function CreateDesktopMultiplexor(parent, domain, nodeid, func) {
|
|||||||
|
|
||||||
// Send data to the agent or queue it up for sending
|
// Send data to the agent or queue it up for sending
|
||||||
obj.sendToAgent = function (data) {
|
obj.sendToAgent = function (data) {
|
||||||
if (obj.agent == null) return;
|
if ((obj.viewers == null) || (obj.agent == null)) return;
|
||||||
//console.log('SendToAgent', data.length);
|
//console.log('SendToAgent', data.length);
|
||||||
if (obj.agent.sending) {
|
if (obj.agent.sending) {
|
||||||
obj.agent.sendQueue.push(data);
|
obj.agent.sendQueue.push(data);
|
||||||
@ -283,7 +285,7 @@ function CreateDesktopMultiplexor(parent, domain, nodeid, func) {
|
|||||||
|
|
||||||
// Send more data to the agent
|
// Send more data to the agent
|
||||||
function sendAgentNext() {
|
function sendAgentNext() {
|
||||||
if (obj.agent == null) return;
|
if ((obj.viewers == null) || (obj.agent == null)) return;
|
||||||
if (obj.agent.sendQueue.length > 0) {
|
if (obj.agent.sendQueue.length > 0) {
|
||||||
// Send from the pending send queue
|
// Send from the pending send queue
|
||||||
obj.agent.ws.send(obj.agent.sendQueue.shift(), sendAgentNext);
|
obj.agent.ws.send(obj.agent.sendQueue.shift(), sendAgentNext);
|
||||||
@ -311,12 +313,13 @@ function CreateDesktopMultiplexor(parent, domain, nodeid, func) {
|
|||||||
|
|
||||||
// Send this command to all viewers
|
// Send this command to all viewers
|
||||||
obj.sendToAllViewers = function (data) {
|
obj.sendToAllViewers = function (data) {
|
||||||
|
if (obj.viewers == null) return;
|
||||||
for (var i in obj.viewers) { obj.sendToViewer(obj.viewers[i], data); }
|
for (var i in obj.viewers) { obj.sendToViewer(obj.viewers[i], data); }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send data to the viewer or queue it up for sending
|
// Send data to the viewer or queue it up for sending
|
||||||
obj.sendToViewer = function (viewer, data) {
|
obj.sendToViewer = function (viewer, data) {
|
||||||
if (viewer == null) return;
|
if ((viewer == null) || (obj.viewers == null)) return;
|
||||||
//console.log('SendToViewer', data.length);
|
//console.log('SendToViewer', data.length);
|
||||||
if (viewer.sending) {
|
if (viewer.sending) {
|
||||||
viewer.sendQueue.push(data);
|
viewer.sendQueue.push(data);
|
||||||
@ -335,7 +338,7 @@ function CreateDesktopMultiplexor(parent, domain, nodeid, func) {
|
|||||||
|
|
||||||
// Check if a viewer is in overflow situation
|
// Check if a viewer is in overflow situation
|
||||||
function checkViewerOverflow(viewer) {
|
function checkViewerOverflow(viewer) {
|
||||||
if (viewer.overflow == true) return;
|
if ((viewer.overflow == true) || (obj.viewers == null)) return;
|
||||||
if ((viewer.sendQueue.length > 5) || ((viewer.dataPtr != null) && (viewer.dataPtr != obj.lastData))) {
|
if ((viewer.sendQueue.length > 5) || ((viewer.dataPtr != null) && (viewer.dataPtr != obj.lastData))) {
|
||||||
viewer.overflow = true;
|
viewer.overflow = true;
|
||||||
obj.viewersOverflowCount++;
|
obj.viewersOverflowCount++;
|
||||||
@ -345,7 +348,7 @@ function CreateDesktopMultiplexor(parent, domain, nodeid, func) {
|
|||||||
|
|
||||||
// Check if a viewer is in underflow situation
|
// Check if a viewer is in underflow situation
|
||||||
function checkViewerUnderflow(viewer) {
|
function checkViewerUnderflow(viewer) {
|
||||||
if (viewer.overflow == false) return;
|
if ((viewer.overflow == false) || (obj.viewers == null)) return;
|
||||||
if ((viewer.sendQueue.length <= 5) && ((viewer.dataPtr == null) || (viewer.dataPtr == obj.lastData))) {
|
if ((viewer.sendQueue.length <= 5) && ((viewer.dataPtr == null) || (viewer.dataPtr == obj.lastData))) {
|
||||||
viewer.overflow = false;
|
viewer.overflow = false;
|
||||||
obj.viewersOverflowCount--;
|
obj.viewersOverflowCount--;
|
||||||
@ -355,7 +358,7 @@ function CreateDesktopMultiplexor(parent, domain, nodeid, func) {
|
|||||||
|
|
||||||
// Send more data to the viewer
|
// Send more data to the viewer
|
||||||
function sendViewerNext(viewer) {
|
function sendViewerNext(viewer) {
|
||||||
if (viewer.sendQueue == null) return;
|
if ((viewer.sendQueue == null) || (obj.viewers == null)) return;
|
||||||
if (viewer.sendQueue.length > 0) {
|
if (viewer.sendQueue.length > 0) {
|
||||||
// Send from the pending send queue
|
// Send from the pending send queue
|
||||||
if (viewer.sending == false) { viewer.sending = true; }
|
if (viewer.sending == false) { viewer.sending = true; }
|
||||||
@ -394,6 +397,7 @@ function CreateDesktopMultiplexor(parent, domain, nodeid, func) {
|
|||||||
|
|
||||||
// Process data coming from the agent or any viewers
|
// Process data coming from the agent or any viewers
|
||||||
obj.processData = function (peer, data) {
|
obj.processData = function (peer, data) {
|
||||||
|
if (obj.viewers == null) return;
|
||||||
if (peer == obj.agent) {
|
if (peer == obj.agent) {
|
||||||
obj.recordingFileWriting = true;
|
obj.recordingFileWriting = true;
|
||||||
recordData(true, data, function () {
|
recordData(true, data, function () {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "meshcentral",
|
"name": "meshcentral",
|
||||||
"version": "0.5.28",
|
"version": "0.5.29",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Remote Management",
|
"Remote Management",
|
||||||
"Intel AMT",
|
"Intel AMT",
|
||||||
|
2
public/scripts/amt-wsman-0.2.0-min.js
vendored
2
public/scripts/amt-wsman-0.2.0-min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user