Device: Add mutex for disk info requests to temporarily work around WiVIClient timeout issues

add-device-sharing
Jonathan Schwartz 2022-04-15 15:18:14 -04:00 committed by Paul Hollinsky
parent c2de1dfdf1
commit 44ad06d4bb
1 changed files with 6 additions and 0 deletions

View File

@ -528,6 +528,9 @@ optional<bool> 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<std::mutex> lg(diskLock);
const auto info = com->getLogicalDiskInfoSync();
if (!info) {
report(APIEvent::Type::Timeout, APIEvent::Severity::Error);
@ -543,6 +546,9 @@ optional<uint64_t> 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<std::mutex> lg(diskLock);
const auto info = com->getLogicalDiskInfoSync();
if (!info) {
report(APIEvent::Type::Timeout, APIEvent::Severity::Error);