From 44ad06d4bb40f5f62330d9ff113d2dc4bb6c597f Mon Sep 17 00:00:00 2001 From: Jonathan Schwartz Date: Fri, 15 Apr 2022 15:18:14 -0400 Subject: [PATCH] Device: Add mutex for disk info requests to temporarily work around WiVIClient timeout issues --- device/device.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/device/device.cpp b/device/device.cpp index 1513c36..9500f8c 100644 --- a/device/device.cpp +++ b/device/device.cpp @@ -528,6 +528,9 @@ optional Device::isLogicalDiskConnected() { return nullopt; } + // This doesn't *really* make sense here but because the disk read redirects the parser until it is done, we'll lock this + // just to avoid the timeout. + std::lock_guard lg(diskLock); const auto info = com->getLogicalDiskInfoSync(); if (!info) { report(APIEvent::Type::Timeout, APIEvent::Severity::Error); @@ -543,6 +546,9 @@ optional Device::getLogicalDiskSize() { return nullopt; } + // This doesn't *really* make sense here but because the disk read redirects the parser until it is done, we'll lock this + // just to avoid the timeout. + std::lock_guard lg(diskLock); const auto info = com->getLogicalDiskInfoSync(); if (!info) { report(APIEvent::Type::Timeout, APIEvent::Severity::Error);