Added merkle base dump at sender in debug mode

master
Harald Wolff 2022-08-19 20:57:43 +02:00
parent db504c72c8
commit 71dfff86a7
1 changed files with 14 additions and 0 deletions

View File

@ -40,6 +40,20 @@ int bs_transfer_thread(bs_engine_t *engine){
fprintf(stdout, "transfering blocks %d of %d blocks need to be transfered (%d%%).\n", changed_blocks, count_blocks, 100 * changed_blocks / count_blocks);
fflush(stdout);
if (engine->tool_flags & BS_DEBUG){
fprintf(stdout, "flushing merkle base to merkle.dump\n");
fflush(stdout);
int md = open("merkle.dump", O_CREAT | O_TRUNC, 0x1FF);
for (int n=0;n<count_blocks;n++) {
write( md, &local_hashes[n], sizeof(uint64_t));
write( md, &remote_hashes[n], sizeof(uint64_t));
}
close(md);
}
for (int n=0;n<count_blocks;n++) {
uint64_t local_hash = local_hashes[n];
uint64_t remote_hash = remote_hashes[n];