static int already_got_block(struct asfd *asfd, struct blk *blk) { //static char *path; static struct hash_weak *hash_weak; // If already got, need to overwrite the references. if((hash_weak=hash_weak_find(blk->fingerprint))) { static struct hash_strong *hash_strong; if((hash_strong=hash_strong_find( hash_weak, blk->md5sum))) { memcpy(blk->savepath, hash_strong->savepath, SAVE_PATH_LEN); //printf("FOUND: %s %s\n", blk->weak, blk->strong); //printf("F"); blk->got=BLK_GOT; asfd->in->got++; return 0; } else { // printf("COLLISION: %s %s\n", blk->weak, blk->strong); // collisions++; } } blk->got=BLK_NOT_GOT; //printf("."); return 0; }
static struct hash_strong *in_local_hash(struct blk *blk) { static struct hash_weak *hash_weak; if(!(hash_weak=hash_weak_find(blk->fingerprint))) return NULL; return hash_strong_find(hash_weak, blk->md5sum); }