From 8999079908ae79e2f6e45ac2bc11b5805d74617b Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 8 Jul 2020 11:02:58 +0200 Subject: [PATCH] check websocket connection --- src/app/files/remixd-handle.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/app/files/remixd-handle.js b/src/app/files/remixd-handle.js index de20c53f88..81e6b5b458 100644 --- a/src/app/files/remixd-handle.js +++ b/src/app/files/remixd-handle.js @@ -70,6 +70,17 @@ export class RemixdHandle extends WebsocketPlugin { ) this.canceled() } else { + const intervalId = setInterval(() => { + if (!this.socket || (this.socket && this.socket.readyState === 3)) { // 3 means connection closed + clearInterval(intervalId) + console.log(error) + modalDialogCustom.alert( + 'Connection to remixd terminated' + + 'Please make sure remixd is still running in the background.' + ) + this.canceled() + } + }, 3000) this.locahostProvider.init(_ => this.fileSystemExplorer.ensureRoot()) } } @@ -85,7 +96,7 @@ export class RemixdHandle extends WebsocketPlugin { try { super.activate() setTimeout(() => { - if (!this.socket) { + if (!this.socket || (this.socket && this.socket.readyState === 3)) { // 3 means connection closed connection(new Error('Connection with daemon failed.')) } else { connection()