mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-21 19:36:55 +02:00
ampr: reuse file-read staging storage on the APR worker
Co-authored-by: Mac <me@itsmemac.com>
This commit is contained in:
@@ -1416,8 +1416,11 @@ static int ReadHostFileToGuest(const std::string& host_path, uint64_t file_offse
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<uint8_t> buffer(
|
static thread_local std::vector<uint8_t> buffer;
|
||||||
static_cast<size_t>(std::min<uint64_t>(APR_HOST_READ_CHUNK_SIZE, readable)));
|
const auto buffer_size = static_cast<size_t>(std::min<uint64_t>(APR_HOST_READ_CHUNK_SIZE, readable));
|
||||||
|
if (buffer.size() < buffer_size) {
|
||||||
|
buffer.resize(buffer_size);
|
||||||
|
}
|
||||||
while (*bytes_read < readable) {
|
while (*bytes_read < readable) {
|
||||||
const auto request =
|
const auto request =
|
||||||
static_cast<uint32_t>(std::min<uint64_t>(buffer.size(), readable - *bytes_read));
|
static_cast<uint32_t>(std::min<uint64_t>(buffer.size(), readable - *bytes_read));
|
||||||
|
|||||||
Reference in New Issue
Block a user