diff --git a/src/siadrive_dokan_api/siadokandrive.cpp b/src/siadrive_dokan_api/siadokandrive.cpp index e807d1d..312c05f 100644 --- a/src/siadrive_dokan_api/siadokandrive.cpp +++ b/src/siadrive_dokan_api/siadokandrive.cpp @@ -549,14 +549,12 @@ private: static NTSTATUS DOKAN_CALLBACK Sia_Mounted(PDOKAN_FILE_INFO DokanFileInfo) { - std::lock_guard l(_dokanMutex); StartFileListThread(); return STATUS_SUCCESS; } static NTSTATUS DOKAN_CALLBACK Sia_Unmounted(PDOKAN_FILE_INFO DokanFileInfo) { - std::lock_guard l(_dokanMutex); StopFileListThread(); return STATUS_SUCCESS; } @@ -791,6 +789,7 @@ private: if (DokanFileInfo->Context) { ::CloseHandle(reinterpret_cast(DokanFileInfo->Context)); + std::lock_guard l(_dokanMutex); _openFileMap.erase(DokanFileInfo->Context); DokanFileInfo->Context = 0; } @@ -876,20 +875,20 @@ public: ZeroMemory(&_dokanOptions, sizeof(DOKAN_OPTIONS)); _dokanOptions.Version = DOKAN_VERSION; _dokanOptions.ThreadCount = 0; // use default - _dokanOptions.Options = DOKAN_OPTION_DEBUG; + _dokanOptions.Options = 0; } static void Mount(const wchar_t& driveLetter, const SString& cacheLocation) { if (_siaApi && !_mountThread) { + // May spend a little wait time here while files are cleaned-up and re-added to queue + _uploadManager.reset(new CUploadManager(CSiaCurl(_siaApi->GetHostConfig()), _siaDriveConfig)); _cacheLocation = cacheLocation; wchar_t tmp[] = { driveLetter, ':', '\\', 0 }; _mountPoint = tmp; _mountThread.reset(new std::thread([&]() { - // May spend a little wait time here while files are cleaned-up and re-added to queue - _uploadManager.reset(new CUploadManager(CSiaCurl(_siaApi->GetHostConfig()), _siaDriveConfig)); _dokanOptions.MountPoint = _mountPoint.ToUpper().str().c_str(); _mountStatus = DokanMain(&_dokanOptions, &_dokanOps); }));