summaryrefslogtreecommitdiffhomepage
path: root/gui/src
diff options
context:
space:
mode:
Diffstat (limited to 'gui/src')
-rw-r--r--gui/src/renderer/app.tsx24
1 files changed, 20 insertions, 4 deletions
diff --git a/gui/src/renderer/app.tsx b/gui/src/renderer/app.tsx
index 5cb32d3517..c468ab12a5 100644
--- a/gui/src/renderer/app.tsx
+++ b/gui/src/renderer/app.tsx
@@ -338,12 +338,28 @@ export default class AppRenderer {
}
}
- public disconnectTunnel(): Promise<void> {
- return IpcRendererEventChannel.tunnel.disconnect();
+ public async disconnectTunnel(): Promise<void> {
+ const state = this.tunnelState.state;
+
+ // disconnect only if tunnel is connected, connecting or blocked.
+ if (state === 'connecting' || state === 'connected' || state === 'error') {
+ // switch to the disconnecting state ahead of time to make the app look more responsive
+ this.reduxActions.connection.disconnecting('nothing');
+
+ return IpcRendererEventChannel.tunnel.disconnect();
+ }
}
- public reconnectTunnel(): Promise<void> {
- return IpcRendererEventChannel.tunnel.reconnect();
+ public async reconnectTunnel(): Promise<void> {
+ const state = this.tunnelState.state;
+
+ // reconnect only if tunnel is connected or connecting.
+ if (state === 'connecting' || state === 'connected') {
+ // switch to the connecting state ahead of time to make the app look more responsive
+ this.reduxActions.connection.connecting();
+
+ return IpcRendererEventChannel.tunnel.reconnect();
+ }
}
public updateRelaySettings(relaySettings: RelaySettingsUpdate) {