mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-11-26 16:06:33 +03:00
show latency in remote/terminal every 10 secs (#5750)
Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
parent
cd2ede8369
commit
cdab553800
@ -81,6 +81,17 @@ var CreateAgentRedirect = function (meshserver, module, serverPublicNamePort, au
|
|||||||
obj.xxOnSocketConnected = function () {
|
obj.xxOnSocketConnected = function () {
|
||||||
if (obj.debugmode == 1) { console.log('onSocketConnected'); }
|
if (obj.debugmode == 1) { console.log('onSocketConnected'); }
|
||||||
//obj.debug('Agent Redir Socket Connected');
|
//obj.debug('Agent Redir Socket Connected');
|
||||||
|
if (!obj.latency.lastSend){
|
||||||
|
obj.latency.lastSend = setInterval(function(){
|
||||||
|
if (obj.latency.current == -1) {
|
||||||
|
clearInterval(obj.latency.lastSend);
|
||||||
|
obj.latency.lastSend = null;
|
||||||
|
} else {
|
||||||
|
obj.sendCtrlMsg(JSON.stringify({ctrlChannel:102938,type:"rtt",time:(new Date().getTime())}));
|
||||||
|
}
|
||||||
|
}, 10000);
|
||||||
|
}
|
||||||
|
obj.sendCtrlMsg(JSON.stringify({ctrlChannel:102938,type:"rtt",time:(new Date().getTime())}));
|
||||||
obj.xxStateChange(2);
|
obj.xxStateChange(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +108,7 @@ var CreateAgentRedirect = function (meshserver, module, serverPublicNamePort, au
|
|||||||
if (obj.onMetadataChange) obj.onMetadataChange(obj.metadata);
|
if (obj.onMetadataChange) obj.onMetadataChange(obj.metadata);
|
||||||
} else if ((controlMsg.type == 'rtt') && (typeof controlMsg.time == 'number')) {
|
} else if ((controlMsg.type == 'rtt') && (typeof controlMsg.time == 'number')) {
|
||||||
obj.latency.current = (new Date().getTime()) - controlMsg.time;
|
obj.latency.current = (new Date().getTime()) - controlMsg.time;
|
||||||
if (obj.latency.callbacks != null) { obj.latency.callback(obj.latency.current); }
|
if (obj.latency.callback != null) { obj.latency.callback(obj.latency.current); }
|
||||||
} else if (obj.webrtc != null) {
|
} else if (obj.webrtc != null) {
|
||||||
if (controlMsg.type == 'answer') {
|
if (controlMsg.type == 'answer') {
|
||||||
obj.webrtc.setRemoteDescription(new RTCSessionDescription(controlMsg), function () { /*console.log('WebRTC remote ok');*/ }, obj.xxCloseWebRTC);
|
obj.webrtc.setRemoteDescription(new RTCSessionDescription(controlMsg), function () { /*console.log('WebRTC remote ok');*/ }, obj.xxCloseWebRTC);
|
||||||
@ -293,6 +304,9 @@ var CreateAgentRedirect = function (meshserver, module, serverPublicNamePort, au
|
|||||||
// Clean up WebRTC
|
// Clean up WebRTC
|
||||||
obj.xxCloseWebRTC();
|
obj.xxCloseWebRTC();
|
||||||
|
|
||||||
|
// clear RTT timer
|
||||||
|
obj.latency.current = -1;
|
||||||
|
|
||||||
//obj.debug('Agent Redir Socket Stopped');
|
//obj.debug('Agent Redir Socket Stopped');
|
||||||
obj.connectstate = -1;
|
obj.connectstate = -1;
|
||||||
if (obj.socket != null) {
|
if (obj.socket != null) {
|
||||||
|
@ -9187,7 +9187,7 @@
|
|||||||
//desktop.m.onDisplayinfo = deskDisplayInfo;
|
//desktop.m.onDisplayinfo = deskDisplayInfo;
|
||||||
desktop.m.onScreenSizeChange = deskAdjust;
|
desktop.m.onScreenSizeChange = deskAdjust;
|
||||||
desktop.Start(desktopNode._id);
|
desktop.Start(desktopNode._id);
|
||||||
desktop.latency.callback = function(ms) { console.log('latency', ms); updateSessionTime(); };
|
desktop.latency.callback = function(ms) { /* console.log('latency', ms); */ updateSessionTime(); };
|
||||||
desktop.contype = 1;
|
desktop.contype = 1;
|
||||||
} else if (contype == 3) {
|
} else if (contype == 3) {
|
||||||
// Ask for user sessions
|
// Ask for user sessions
|
||||||
|
Loading…
Reference in New Issue
Block a user