Fixed unhandled exception that can occur when you close privacy bar
Bryan Roe committed
Apr 28, 2020 at 11:36 UTC
3e50b0bdab71ecd1fca567496db54a57a92e32cf
1 file changed
+27
-8
agents/meshcore.js
+27
-8
@@ -1395,13 +1395,26 @@ function createMeshCore(agent) {
1395
--this.desktop.kvm.connectionCount;
1396
1397
// Unpipe the web socket
1398
- this.unpipe(this.httprequest.desktop.kvm);
1399
- this.httprequest.desktop.kvm.unpipe(this);
1398
+ try
1399
+ {
1400
+ this.unpipe(this.httprequest.desktop.kvm);
1401
+ this.httprequest.desktop.kvm.unpipe(this);
1402
+ }
1403
+ catch(xx)
1404
+ {
1405
+ }
1406
1407
// Unpipe the WebRTC channel if needed (This will also be done when the WebRTC channel ends).
1402
- if (this.rtcchannel) {
1403
- this.rtcchannel.unpipe(this.httprequest.desktop.kvm);
1404
- this.httprequest.desktop.kvm.unpipe(this.rtcchannel);
1408
+ if (this.rtcchannel)
1409
+ {
1410
+ try
1411
+ {
1412
+ this.rtcchannel.unpipe(this.httprequest.desktop.kvm);
1413
+ this.httprequest.desktop.kvm.unpipe(this.rtcchannel);
1414
+ }
1415
+ catch(xx)
1416
+ {
1417
+ }
1418
}
1419
1420
// Place wallpaper back if needed
@@ -1944,9 +1957,15 @@ function createMeshCore(agent) {
1957
this.websocket.rtcchannel.on('end', function () {
1958
// The WebRTC channel closed, unpipe the KVM now. This is also done when the web socket closes.
1959
//sendConsoleText('Tunnel #' + this.websocket.tunnel.index + ' WebRTC data channel closed');
1947
- if (this.websocket.desktop && this.websocket.desktop.kvm) {
1948
- this.unpipe(this.websocket.desktop.kvm);
1949
- this.websocket.httprequest.desktop.kvm.unpipe(this);
1960
+ if (this.websocket.desktop && this.websocket.desktop.kvm)
1961
+ {
1962
+ try
1963
+ {
1964
+ this.unpipe(this.websocket.desktop.kvm);
1965
+ this.websocket.httprequest.desktop.kvm.unpipe(this);
1966
+ }
1967
+ catch (xx)
1968
+ { }
1969
}
1970
});
1971
this.websocket.write('{\"ctrlChannel\":\"102938\",\"type\":\"webrtc0\"}'); // Indicate we are ready for WebRTC switch-over.