also store chunk crcs in patch metadata cache
This commit is contained in:
+5
-4
@@ -471,8 +471,8 @@ void send_enter_directory_patch(shared_ptr<Client> c, const string& dir) {
|
||||
send_command_t(c, 0x09, 0x00, cmd);
|
||||
}
|
||||
|
||||
void send_patch_file(shared_ptr<Client> c, shared_ptr<const PatchFileIndex::File> f) {
|
||||
S_OpenFile_Patch_06 open_cmd = {0, f->data->size(), f->name};
|
||||
void send_patch_file(shared_ptr<Client> c, shared_ptr<PatchFileIndex::File> f) {
|
||||
S_OpenFile_Patch_06 open_cmd = {0, f->size, f->name};
|
||||
send_command_t(c, 0x06, 0x00, open_cmd);
|
||||
|
||||
for (size_t x = 0; x < f->chunk_crcs.size(); x++) {
|
||||
@@ -480,11 +480,12 @@ void send_patch_file(shared_ptr<Client> c, shared_ptr<const PatchFileIndex::File
|
||||
// Channel::send that takes iovecs or something to avoid these dumb massive
|
||||
// string copies.
|
||||
StringWriter w;
|
||||
size_t chunk_size = min<uint32_t>(f->data->size() - x * 0x4000, 0x4000);
|
||||
auto data = f->load_data();
|
||||
size_t chunk_size = min<uint32_t>(f->size - (x * 0x4000), 0x4000);
|
||||
S_WriteFileHeader_Patch_07 write_cmd_header = {
|
||||
x, f->chunk_crcs[x], chunk_size};
|
||||
w.put(write_cmd_header);
|
||||
w.write(f->data->data() + x * 0x4000, chunk_size);
|
||||
w.write(data->data() + (x * 0x4000), chunk_size);
|
||||
while (w.size() & 7) {
|
||||
w.put_u8(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user