From af68d20d4285bd499c3e7e14713c906e8505ffbe Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Mon, 25 Nov 2019 13:14:34 -0600 Subject: [PATCH] Improved mount state detection --- CHANGELOG.md | 1 + src/containers/MountItems/MountItems.js | 29 ++++++++++++++----------- src/renderer/ipc/MountsIPC.js | 2 ++ 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7abbfb1..8ba9ee9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## 1.1.1 * \#43: Support for remote UNIX mounts +* Improved mount state detection ## 1.1.0 * \#40: Support for remote Windows mounts diff --git a/src/containers/MountItems/MountItems.js b/src/containers/MountItems/MountItems.js index 3725e10..9ac9228 100644 --- a/src/containers/MountItems/MountItems.js +++ b/src/containers/MountItems/MountItems.js @@ -228,20 +228,23 @@ class MountItems extends IPCContainer { }; onDetectMountReply = (event, arg) => { - if (!this.state.DisplayRetry && arg.data.Success) { - const provider = arg.data.Provider; - const mountState = { - AllowMount: true, - DriveLetters: (arg.data.DriveLetters), - Mounted: (arg.data.Location.length > 0), - }; - this.props.setMountState(provider, mountState); + const provider = arg.data.Provider; + if (!this.state.RetryItems[provider]) { + if (arg.data.Success && (!arg.data.Active || (arg.data.Location && (arg.data.Location.length > 0)))) { + const mountState = { + AllowMount: true, + DriveLetters: arg.data.DriveLetters, + Mounted: arg.data.Active, + }; + this.props.setMountState(provider, mountState); - this.updateMountLocation(provider, arg.data.Location, mountState.Mounted, arg.data.DriveLetters); - this.props.setAutoMountProcessed(provider,true); - this.removeMountsBusy(provider); - } else { - this.props.notifyError(arg.data.Error); + this.updateMountLocation(provider, arg.data.Location, mountState.Mounted, arg.data.DriveLetters); + this.props.setAutoMountProcessed(provider, true); + this.removeMountsBusy(provider); + } else { + this.detectMount(provider); + this.removeMountsBusy(provider); + } } }; diff --git a/src/renderer/ipc/MountsIPC.js b/src/renderer/ipc/MountsIPC.js index 4d261b3..9c789cc 100644 --- a/src/renderer/ipc/MountsIPC.js +++ b/src/renderer/ipc/MountsIPC.js @@ -177,8 +177,10 @@ const addListeners = (ipcMain, setTrayImage, standardIPCReply) => { firstMountCheck = false; } standardIPCReply(event, Constants.IPC_Detect_Mount_Reply, { + Active: storageData[provider].Active, DriveLetters: driveLetters[provider], Location: locations[provider], + PID: storageData[provider].PID, Provider: provider, }); })