add extra layer of checks for data races in download

yeah
This commit is contained in:
Lion Kortlepel 2024-09-22 19:52:52 +02:00
parent 79209219dd
commit 96c9c89238
No known key found for this signature in database
GPG Key ID: 4322FF2B4C71259B

View File

@ -217,6 +217,13 @@ std::vector<char> MultiDownload(SOCKET MSock, SOCKET DSock, uint64_t Size, const
return {};
}
// ensure that GRcv is good before joining the async update thread
GRcv = MData.size() + DData.size();
if (GRcv != Size) {
error("Something went wrong during download; didn't get enough data. Expected " + std::to_string(Size) + " bytes, got " + std::to_string(GRcv) + " bytes instead");
return {};
}
Au.join();
std::vector<char> Result{};